qpid/console/Object.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/Object.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_OBJECT_H_
    00022 #define _QPID_CONSOLE_OBJECT_H_
    00023
    00024 #include "qpid/console/ConsoleImportExport.h"
    00025 #include "qpid/console/ObjectId.h"
    00026 #include "qpid/framing/Uuid.h"
    00027 #include "qpid/framing/FieldTable.h"
    00028 #include <boost/shared_ptr.hpp>
    00029 #include <map>
    00030 #include <set>
    00031 #include <vector>
    00032
    00033 namespace qpid {
    00034 namespace framing {
    00035     class Buffer;
    00036 }
    00037 namespace console {
    00038
    00039     class  Broker;
    00040     struct SchemaClass;
    00041     struct SchemaMethod;
    00042     class  ObjectId;
    00043     class  ClassKey;
    00044     class  Value;
    00045
    00049     struct MethodResponse {
    00050         uint32_t code;
    00051         std::string text;
    00052         std::map<std::string, boost::shared_ptr<Value> > arguments;
    00053     };
    00054
    00055     class Object {
    00056     public:
    00057         typedef std::vector<Object> Vector;
    00058         struct AttributeMap : public std::map<std::string, boost::shared_ptr<Value> > {
    00059             QPID_CONSOLE_EXTERN void addRef(const std::string& key, const ObjectId& val);
    00060             QPID_CONSOLE_EXTERN void addUint(const std::string& key, uint32_t val);
    00061             QPID_CONSOLE_EXTERN void addInt(const std::string& key, int32_t val);
    00062             QPID_CONSOLE_EXTERN void addUint64(const std::string& key, uint64_t val);
    00063             QPID_CONSOLE_EXTERN void addInt64(const std::string& key, int64_t val);
    00064             QPID_CONSOLE_EXTERN void addString(const std::string& key, const std::string& val);
    00065             QPID_CONSOLE_EXTERN void addBool(const std::string& key, bool val);
    00066             QPID_CONSOLE_EXTERN void addFloat(const std::string& key, float val);
    00067             QPID_CONSOLE_EXTERN void addDouble(const std::string& key, double val);
    00068             QPID_CONSOLE_EXTERN void addUuid(const std::string& key, const framing::Uuid& val);
    00069             QPID_CONSOLE_EXTERN void addMap(const std::string& key, const framing::FieldTable& val);
    00070         };
    00071
    00072         QPID_CONSOLE_EXTERN Object(Broker* broker, SchemaClass* schemaClass, framing::Buffer& buffer, bool prop, bool stat);
    00073         QPID_CONSOLE_EXTERN ~Object();
    00074
    00075         Broker* getBroker() const { return broker; }
    00076         const ObjectId& getObjectId() const { return objectId; }
    00077         QPID_CONSOLE_EXTERN const ClassKey& getClassKey() const;
    00078         SchemaClass* getSchema() const { return schema; }
    00079         uint64_t getCurrentTime() const { return currentTime; }
    00080         uint64_t getCreateTime() const { return createTime; }
    00081         uint64_t getDeleteTime() const { return deleteTime; }
    00082         bool isDeleted() const { return deleteTime != 0; }
    00083         QPID_CONSOLE_EXTERN std::string getIndex() const;
    00084         QPID_CONSOLE_EXTERN void mergeUpdate(const Object& updated);
    00085         const AttributeMap& getAttributes() const { return attributes; }
    00086         QPID_CONSOLE_EXTERN void invokeMethod(const std::string name,
    00087                                               const AttributeMap& args,
    00088                                               MethodResponse& result);
    00089         QPID_CONSOLE_EXTERN void handleMethodResp(framing::Buffer& buffer,
    00090                                                   uint32_t sequence);
    00091
    00092         QPID_CONSOLE_EXTERN ObjectId attrRef(const std::string& key) const;
    00093         QPID_CONSOLE_EXTERN uint32_t attrUint(const std::string& key) const;
    00094         QPID_CONSOLE_EXTERN int32_t attrInt(const std::string& key) const;
    00095         QPID_CONSOLE_EXTERN uint64_t attrUint64(const std::string& key) const;
    00096         QPID_CONSOLE_EXTERN int64_t attrInt64(const std::string& key) const;
    00097         QPID_CONSOLE_EXTERN std::string attrString(const std::string& key) const;
    00098         QPID_CONSOLE_EXTERN bool attrBool(const std::string& key) const;
    00099         QPID_CONSOLE_EXTERN float attrFloat(const std::string& key) const;
    00100         QPID_CONSOLE_EXTERN double attrDouble(const std::string& key) const;
    00101         QPID_CONSOLE_EXTERN framing::Uuid attrUuid(const std::string& key) const;
    00102         QPID_CONSOLE_EXTERN framing::FieldTable attrMap(const std::string& key) const;
    00103
    00104     private:
    00105         Broker* broker;
    00106         SchemaClass* schema;
    00107         ObjectId objectId;
    00108         uint64_t currentTime;
    00109         uint64_t createTime;
    00110         uint64_t deleteTime;
    00111         AttributeMap attributes;
    00112         SchemaMethod* pendingMethod;
    00113         MethodResponse methodResponse;
    00114
    00115         void parsePresenceMasks(framing::Buffer& buffer, std::set<std::string>& excludeList);
    00116     };
    00117
    00118     QPID_CONSOLE_EXTERN std::ostream& operator<<(std::ostream& o, const Object& object);
    00119 }
    00120 }
    00121
    00122
    00123 #endif