Qpid .NET Messaging API  0.22
QpidTypeCheck.h
Go to the documentation of this file.
00001 /*
00002 * Licensed to the Apache Software Foundation (ASF) under one
00003 * or more contributor license agreements.  See the NOTICE file
00004 * distributed with this work for additional information
00005 * regarding copyright ownership.  The ASF licenses this file
00006 * to you under the Apache License, Version 2.0 (the
00007 * "License"); you may not use this file except in compliance
00008 * with the License.  You may obtain a copy of the License at
00009 *
00010 *   http://www.apache.org/licenses/LICENSE-2.0
00011 *
00012 * Unless required by applicable law or agreed to in writing,
00013 * software distributed under the License is distributed on an
00014 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
00015 * KIND, either express or implied.  See the License for the
00016 * specific language governing permissions and limitations
00017 * under the License.
00018 */
00019 #pragma once
00020 
00021 #include <windows.h>
00022 #include <msclr\lock.h>
00023 #include <oletx2xa.h>
00024 #include <string>
00025 #include <limits>
00026 
00027 namespace Org {
00028 namespace Apache {
00029 namespace Qpid {
00030 namespace Messaging {
00031 
00036     // The supported mapping is:
00040 
00041     typedef System::Collections::Generic::Dictionary<
00042                 System::String^,
00043                 System::Object^>
00044                     QpidMap;
00045 
00046     typedef System::Collections::ObjectModel::Collection<
00047                 System::Object^>
00048                     QpidList;
00049 
00050     private ref class QpidTypeCheckConstants sealed
00051     {
00052     private:
00053         QpidTypeCheckConstants::QpidTypeCheckConstants() {}
00054 
00055     public:
00056         static System::Type const ^ const mapTypeP = System::Type::GetType(
00057             "System.Collections.Generic.Dictionary`2[System.String,System.Object]");
00058         static System::Type const ^ const listTypeP = System::Type::GetType(
00059             "System.Collections.ObjectModel.Collection`1[System.Object]");
00060     };
00061 
00062 
00063     public ref class QpidTypeCheck sealed
00064     {
00065     private:
00066         QpidTypeCheck::QpidTypeCheck() {}
00067 
00068     public:
00069 
00070         static bool ObjectIsMap (System::Object ^ theValue)
00071         {
00072             if (nullptr == theValue)
00073                 return false;
00074             else
00075                 return (*theValue).GetType() == QpidTypeCheckConstants::mapTypeP;
00076         }
00077 
00078         static bool ObjectIsList(System::Object ^ theValue)
00079         {
00080             if (nullptr == theValue)
00081                 return false;
00082             else
00083                 return (*theValue).GetType() == QpidTypeCheckConstants::listTypeP;
00084         }
00085     };
00086 }}}}