Qpid Management Framework  0.22
qmf/engine/Value.h
Go to the documentation of this file.
00001 #ifndef _QmfEngineValue_
00002 #define _QmfEngineValue_
00003 
00004 /*
00005  * Licensed to the Apache Software Foundation (ASF) under one
00006  * or more contributor license agreements.  See the NOTICE file
00007  * distributed with this work for additional information
00008  * regarding copyright ownership.  The ASF licenses this file
00009  * to you under the Apache License, Version 2.0 (the
00010  * "License"); you may not use this file except in compliance
00011  * with the License.  You may obtain a copy of the License at
00012  * 
00013  *   http://www.apache.org/licenses/LICENSE-2.0
00014  * 
00015  * Unless required by applicable law or agreed to in writing,
00016  * software distributed under the License is distributed on an
00017  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
00018  * KIND, either express or implied.  See the License for the
00019  * specific language governing permissions and limitations
00020  * under the License.
00021  */
00022 
00023 #include <qmf/engine/ObjectId.h>
00024 #include <qmf/engine/Typecode.h>
00025 
00026 namespace qmf {
00027 namespace engine {
00028 
00029     class Object;
00030     struct ValueImpl;
00031 
00032     class Value {
00033     public:
00034         //        Value();
00035         Value(const Value& from);
00036         Value(Typecode t, Typecode arrayType = TYPE_UINT8);
00037         ~Value();
00038 
00039         Typecode getType() const;
00040         bool isNull() const;
00041         void setNull();
00042 
00043         bool isObjectId() const;
00044         const ObjectId& asObjectId() const;
00045         void setObjectId(const ObjectId& oid);
00046 
00047         bool isUint() const;
00048         uint32_t asUint() const;
00049         void setUint(uint32_t val);
00050 
00051         bool isInt() const;
00052         int32_t asInt() const;
00053         void setInt(int32_t val);
00054 
00055         bool isUint64() const;
00056         uint64_t asUint64() const;
00057         void setUint64(uint64_t val);
00058 
00059         bool isInt64() const;
00060         int64_t asInt64() const;
00061         void setInt64(int64_t val);
00062 
00063         bool isString() const;
00064         const char* asString() const;
00065         void setString(const char* val);
00066 
00067         bool isBool() const;
00068         bool asBool() const;
00069         void setBool(bool val);
00070 
00071         bool isFloat() const;
00072         float asFloat() const;
00073         void setFloat(float val);
00074 
00075         bool isDouble() const;
00076         double asDouble() const;
00077         void setDouble(double val);
00078 
00079         bool isUuid() const;
00080         const uint8_t* asUuid() const;
00081         void setUuid(const uint8_t* val);
00082 
00083         bool isObject() const;
00084         const Object* asObject() const;
00085         void setObject(Object* val);
00086 
00087         bool isMap() const;
00088         bool keyInMap(const char* key) const;
00089         Value* byKey(const char* key);
00090         const Value* byKey(const char* key) const;
00091         void deleteKey(const char* key);
00092         void insert(const char* key, Value* val);
00093         uint32_t keyCount() const;
00094         const char* key(uint32_t idx) const;
00095 
00096         bool isList() const;
00097         uint32_t listItemCount() const;
00098         Value* listItem(uint32_t idx);
00099         void appendToList(Value* val);
00100         void deleteListItem(uint32_t idx);
00101 
00102         bool isArray() const;
00103         Typecode arrayType() const;
00104         uint32_t arrayItemCount() const;
00105         Value* arrayItem(uint32_t idx);
00106         void appendToArray(Value* val);
00107         void deleteArrayItem(uint32_t idx);
00108 
00109     private:
00110         friend struct ValueImpl;
00111         friend class  BrokerProxyImpl;
00112         friend struct ObjectImpl;
00113         friend struct EventImpl;
00114         friend class  AgentImpl;
00115         Value(ValueImpl* impl);
00116         ValueImpl* impl;
00117     };
00118 }
00119 }
00120 
00121 #endif
00122