dcrud  0.0.0
Distributed data and services
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends
Arguments.hpp
Go to the documentation of this file.
1 #pragma once
2 
3 #include <dcrud/ClassID.hpp>
4 #include <dcrud/GUID.hpp>
5 
6 #include <map>
7 #include <string>
8 #include <stdexcept>
9 
10 namespace dcrud {
11 
12  class Shareable;
13  class ParticipantImpl;
14 
15  class Arguments {
16  public:
17 
18  Arguments( void );
19 
20  ~ Arguments();
21 
22  void clear();
23 
24  bool isEmpty() const {
25  return _args.empty();
26  }
27 
28  size_t getCount() const {
29  return _args.size();
30  }
31 
32  void putNull( const std::string & key );
33  void put ( const std::string & key, const byte & value );
34  void put ( const std::string & key, const bool & value );
35  void put ( const std::string & key, const unsigned short & value );
36  void put ( const std::string & key, const unsigned int & value );
37  void put ( const std::string & key, const uint64_t & value );
38  void put ( const std::string & key, const float & value );
39  void put ( const std::string & key, const double & value );
40  void put ( const std::string & key, const std::string & value );
41  void put ( const std::string & key, const ClassID & value );
42  void put ( const std::string & key, const GUID & value );
43  void put ( const std::string & key, const Shareable * value );
44 
45  bool isNull ( const std::string & key ) const;
46  bool get ( const std::string & key, byte & value ) const;
47  bool get ( const std::string & key, bool & value ) const;
48  bool get ( const std::string & key, unsigned short & value ) const;
49  bool get ( const std::string & key, unsigned int & value ) const;
50  bool get ( const std::string & key, uint64_t & value ) const;
51  bool get ( const std::string & key, float & value ) const;
52  bool get ( const std::string & key, double & value ) const;
53  bool get ( const std::string & key, std::string & value ) const;
54  bool get ( const std::string & key, ClassID & value ) const;
55  bool get ( const std::string & key, GUID & value ) const;
56  bool get ( const std::string & key, Shareable * & value ) const;
57 
58  void setMode ( byte mode );
59 
60  void setQueue( byte queue );
61 
62  ClassID::Type getType( const std::string & key ) const;
63 
64  void serialize( io::ByteBuffer & message ) const;
65 
66  private:
67 
68  typedef std::map<std::string, void *> args_t;
69  typedef args_t::iterator argsIter_t;
70  typedef args_t::const_iterator argsCstIter_t;
71 
72  typedef std::map<std::string, ClassID::Type> types_t;
73  typedef types_t::iterator typesIter_t;
74  typedef types_t::const_iterator typesCstIter_t;
75 
76  args_t _args;
77  types_t _types;
78  };
79 }
size_t getCount() const
Definition: Arguments.hpp:28
ClassID::Type getType(const std::string &key) const
void serialize(io::ByteBuffer &message) const
void setMode(byte mode)
void setQueue(byte queue)
void putNull(const std::string &key)
bool isNull(const std::string &key) const
void put(const std::string &key, const byte &value)
bool isEmpty() const
Definition: Arguments.hpp:24