Apache Qpid - AMQP Messaging for Java JMS, C++, Python, Ruby, and .NET Apache Qpid Documentation
Object.h
Go to the documentation of this file.
1 /*
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements. See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership. The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License. You may obtain a copy of the License at
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied. See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  */
21 #ifndef _QPID_CONSOLE_OBJECT_H_
22 #define _QPID_CONSOLE_OBJECT_H_
23 
25 #include "qpid/console/ObjectId.h"
26 #include "qpid/framing/Uuid.h"
28 #include <boost/shared_ptr.hpp>
29 #include <map>
30 #include <set>
31 #include <vector>
32 
33 namespace qpid {
34 namespace framing {
35  class Buffer;
36 }
37 namespace console {
38 
39  class Broker;
40  struct SchemaClass;
41  struct SchemaMethod;
42  class ObjectId;
43  class ClassKey;
44  class Value;
45 
49  struct MethodResponse {
51  std::string text;
52  std::map<std::string, boost::shared_ptr<Value> > arguments;
53  };
54 
55  class Object {
56  public:
57  typedef std::vector<Object> Vector;
58  struct AttributeMap : public std::map<std::string, boost::shared_ptr<Value> > {
59  QPID_CONSOLE_EXTERN void addRef(const std::string& key, const ObjectId& val);
60  QPID_CONSOLE_EXTERN void addUint(const std::string& key, uint32_t val);
61  QPID_CONSOLE_EXTERN void addInt(const std::string& key, int32_t val);
62  QPID_CONSOLE_EXTERN void addUint64(const std::string& key, uint64_t val);
63  QPID_CONSOLE_EXTERN void addInt64(const std::string& key, int64_t val);
64  QPID_CONSOLE_EXTERN void addString(const std::string& key, const std::string& val);
65  QPID_CONSOLE_EXTERN void addBool(const std::string& key, bool val);
66  QPID_CONSOLE_EXTERN void addFloat(const std::string& key, float val);
67  QPID_CONSOLE_EXTERN void addDouble(const std::string& key, double val);
68  QPID_CONSOLE_EXTERN void addUuid(const std::string& key, const framing::Uuid& val);
69  QPID_CONSOLE_EXTERN void addMap(const std::string& key, const framing::FieldTable& val);
70  };
71 
72  QPID_CONSOLE_EXTERN Object(Broker* broker, SchemaClass* schemaClass, framing::Buffer& buffer, bool prop, bool stat);
74 
75  Broker* getBroker() const { return broker; }
76  const ObjectId& getObjectId() const { return objectId; }
78  SchemaClass* getSchema() const { return schema; }
79  uint64_t getCurrentTime() const { return currentTime; }
80  uint64_t getCreateTime() const { return createTime; }
81  uint64_t getDeleteTime() const { return deleteTime; }
82  bool isDeleted() const { return deleteTime != 0; }
83  QPID_CONSOLE_EXTERN std::string getIndex() const;
84  QPID_CONSOLE_EXTERN void mergeUpdate(const Object& updated);
85  const AttributeMap& getAttributes() const { return attributes; }
86  QPID_CONSOLE_EXTERN void invokeMethod(const std::string name,
87  const AttributeMap& args,
88  MethodResponse& result);
90  uint32_t sequence);
91 
92  QPID_CONSOLE_EXTERN ObjectId attrRef(const std::string& key) const;
93  QPID_CONSOLE_EXTERN uint32_t attrUint(const std::string& key) const;
94  QPID_CONSOLE_EXTERN int32_t attrInt(const std::string& key) const;
95  QPID_CONSOLE_EXTERN uint64_t attrUint64(const std::string& key) const;
96  QPID_CONSOLE_EXTERN int64_t attrInt64(const std::string& key) const;
97  QPID_CONSOLE_EXTERN std::string attrString(const std::string& key) const;
98  QPID_CONSOLE_EXTERN bool attrBool(const std::string& key) const;
99  QPID_CONSOLE_EXTERN float attrFloat(const std::string& key) const;
100  QPID_CONSOLE_EXTERN double attrDouble(const std::string& key) const;
101  QPID_CONSOLE_EXTERN framing::Uuid attrUuid(const std::string& key) const;
102  QPID_CONSOLE_EXTERN framing::FieldTable attrMap(const std::string& key) const;
103 
104  private:
105  Broker* broker;
106  SchemaClass* schema;
107  ObjectId objectId;
108  uint64_t currentTime;
109  uint64_t createTime;
110  uint64_t deleteTime;
111  AttributeMap attributes;
112  SchemaMethod* pendingMethod;
113  MethodResponse methodResponse;
114 
115  void parsePresenceMasks(framing::Buffer& buffer, std::set<std::string>& excludeList);
116  };
117 
118  QPID_CONSOLE_EXTERN std::ostream& operator<<(std::ostream& o, const Object& object);
119 }
120 }
121 
122 
123 #endif
double attrDouble(const std::string &key) const
const AttributeMap & getAttributes() const
Definition: Object.h:85
bool attrBool(const std::string &key) const
void addUint(const std::string &key, uint32_t val)
void addBool(const std::string &key, bool val)
std::ostream & operator<<(std::ostream &o, const Agent &agent)
uint64_t getCurrentTime() const
Definition: Object.h:79
std::vector< Object > Vector
Definition: Object.h:57
A UUID is represented as a boost::array of 16 bytes.
Definition: Uuid.h:44
unsigned int uint32_t
Definition: IntegerTypes.h:27
int64_t attrInt64(const std::string &key) const
const ObjectId & getObjectId() const
Definition: Object.h:76
void addInt64(const std::string &key, int64_t val)
uint32_t attrUint(const std::string &key) const
void addInt(const std::string &key, int32_t val)
framing::FieldTable attrMap(const std::string &key) const
int int32_t
Definition: IntegerTypes.h:28
void addMap(const std::string &key, const framing::FieldTable &val)
void addUint64(const std::string &key, uint64_t val)
int32_t attrInt(const std::string &key) const
float attrFloat(const std::string &key) const
const ClassKey & getClassKey() const
uint64_t getDeleteTime() const
Definition: Object.h:81
Object(Broker *broker, SchemaClass *schemaClass, framing::Buffer &buffer, bool prop, bool stat)
A set of name-value pairs.
Definition: FieldTable.h:53
std::map< std::string, boost::shared_ptr< Value > > arguments
Definition: Object.h:52
void addUuid(const std::string &key, const framing::Uuid &val)
std::string attrString(const std::string &key) const
bool isDeleted() const
Definition: Object.h:82
void addString(const std::string &key, const std::string &val)
void addDouble(const std::string &key, double val)
Broker * getBroker() const
Definition: Object.h:75
ObjectId attrRef(const std::string &key) const
void addRef(const std::string &key, const ObjectId &val)
void invokeMethod(const std::string name, const AttributeMap &args, MethodResponse &result)
SchemaClass * getSchema() const
Definition: Object.h:78
uint64_t attrUint64(const std::string &key) const
std::string getIndex() const
framing::Uuid attrUuid(const std::string &key) const
uint64_t getCreateTime() const
Definition: Object.h:80
void addFloat(const std::string &key, float val)
void mergeUpdate(const Object &updated)
#define QPID_CONSOLE_EXTERN
void handleMethodResp(framing::Buffer &buffer, uint32_t sequence)

Qpid C++ API Reference
Generated on Thu Mar 31 2016 for Qpid C++ Client API by doxygen 1.8.5