qpid/console/Package.h Source File

Apache Qpid - AMQP Messaging for Java JMS, C++, Python, Ruby, and .NET | Apache Qpid Documentation

- Main Page
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

qpid/console/Package.h
Go to the documentation of this file.

    00001 /*
    00002  *
    00003  * Licensed to the Apache Software Foundation (ASF) under one
    00004  * or more contributor license agreements.  See the NOTICE file
    00005  * distributed with this work for additional information
    00006  * regarding copyright ownership.  The ASF licenses this file
    00007  * to you under the Apache License, Version 2.0 (the
    00008  * "License"); you may not use this file except in compliance
    00009  * with the License.  You may obtain a copy of the License at
    00010  *
    00011  *   http://www.apache.org/licenses/LICENSE-2.0
    00012  *
    00013  * Unless required by applicable law or agreed to in writing,
    00014  * software distributed under the License is distributed on an
    00015  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
    00016  * KIND, either express or implied.  See the License for the
    00017  * specific language governing permissions and limitations
    00018  * under the License.
    00019  *
    00020  */
    00021 #ifndef _QPID_CONSOLE_PACKAGE_H_
    00022 #define _QPID_CONSOLE_PACKAGE_H_
    00023
    00024 #include <string>
    00025 #include <map>
    00026 #include "qpid/console/ConsoleImportExport.h"
    00027 #include "qpid/sys/IntegerTypes.h"
    00028
    00029 namespace qpid {
    00030 namespace console {
    00031     struct SchemaClass;
    00032
    00037     class Package {
    00038     public:
    00039         Package(const std::string& n) : name(n) {}
    00040         const std::string& getName() const { return name; }
    00041
    00042     private:
    00043         friend class SessionManager;
    00044         struct NameHash {
    00045             std::string name;
    00046             uint8_t     hash[16];
    00047             NameHash(const std::string& n, const uint8_t* h) : name(n) {
    00048                 for (int i = 0; i < 16; i++)
    00049                     hash[i] = h[i];
    00050             }
    00051         };
    00052
    00053         struct NameHashComp {
    00054             bool operator() (const NameHash& lhs, const NameHash& rhs) const
    00055             {
    00056                 if (lhs.name != rhs.name)
    00057                     return lhs.name < rhs.name;
    00058                 else
    00059                     for (int i = 0; i < 16; i++)
    00060                         if (lhs.hash[i] != rhs.hash[i])
    00061                             return lhs.hash[i] < rhs.hash[i];
    00062                 return false;
    00063             }
    00064         };
    00065
    00066         typedef std::map<NameHash, SchemaClass*, NameHashComp> ClassMap;
    00067
    00068         const std::string name;
    00069         ClassMap classes;
    00070
    00071         SchemaClass* getClass(const std::string& className, uint8_t* hash);
    00072         void addClass(const std::string& className, uint8_t* hash,
    00073                       SchemaClass* schemaClass);
    00074     };
    00075 }
    00076 }
    00077
    00078 #endif