Collage  1.5.0
High-performance C++ library for developing object-oriented distributed applications.
co::ICommand Class Reference

A class managing received commands. More...

#include <iCommand.h>

+ Inheritance diagram for co::ICommand:
+ Collaboration diagram for co::ICommand:

Public Member Functions

CO_API ICommand (LocalNodePtr local, NodePtr remote, ConstBufferPtr buffer, const bool swap)
 
CO_API ICommand (const ICommand &rhs)
 
CO_API ICommandoperator= (const ICommand &rhs)
 
CO_API void clear ()
 
Data Access
CO_API uint32_t getType () const
 
CO_API uint32_t getCommand () const
 
CO_API uint64_t getSize () const
 
template<typename T >
get ()
 
NodePtr getNode () const
 
CO_API NodePtr getRemoteNode () const override
 
CO_API LocalNodePtr getLocalNode () const override
 
CO_API bool isValid () const
 
CO_API ConstBufferPtr getBuffer () const
 
CO_API void setType (const CommandType type)
 
CO_API void setCommand (const uint32_t cmd)
 
void setDispatchFunction (const Dispatcher::Func &func)
 
CO_API bool operator() ()
 
- Public Member Functions inherited from co::DataIStream
virtual void reset ()
 
void setSwapping (const bool onOff)
 
CO_API bool isSwapping () const
 
DataIStreamoperator= (const DataIStream &rhs)
 
template<typename T >
read ()
 
template<class T >
DataIStreamoperator>> (T &value)
 Read a plain data item. More...
 
template<class T >
DataIStreamoperator>> (Array< T > array)
 Read a C array. More...
 
template<class T >
DataIStreamoperator>> (lunchbox::RefPtr< T > &)
 Read a lunchbox::RefPtr. More...
 
template<class T >
DataIStreamoperator>> (lunchbox::Buffer< T > &)
 Read a lunchbox::Buffer. More...
 
template<class T >
DataIStreamoperator>> (std::vector< T > &)
 Read a std::vector of serializable items. More...
 
template<class K , class V >
DataIStreamoperator>> (std::map< K, V > &)
 Read a std::map of serializable items. More...
 
template<class T >
DataIStreamoperator>> (std::set< T > &)
 Read a std::set of serializable items. More...
 
template<class K , class V >
DataIStreamoperator>> (stde::hash_map< K, V > &)
 Read a stde::hash_map of serializable items. More...
 
template<class T >
DataIStreamoperator>> (stde::hash_set< T > &)
 Read a stde::hash_set of serializable items. More...
 
template<typename O , typename C >
void deserializeChildren (O *object, const std::vector< C * > &old, std::vector< C * > &result)
 
CO_API const void * getRemainingBuffer (const uint64_t size)
 
CO_API uint64_t getRemainingBufferSize ()
 
bool wasUsed () const
 
bool hasData ()
 
template<>
DataIStreamoperator>> (std::string &str)
 Read a std::string. More...
 
template<>
DataIStreamoperator>> (Object *&object)
 Deserialize an object (id+version). More...
 
template<>
DataIStreamoperator>> (std::vector< uint8_t > &value)
 Optimized specialization to read a std::vector of uint8_t. More...
 
template<>
DataIStreamoperator>> (std::vector< uint16_t > &value)
 Optimized specialization to read a std::vector of uint16_t. More...
 
template<>
DataIStreamoperator>> (std::vector< int16_t > &value)
 Optimized specialization to read a std::vector of int16_t. More...
 
template<>
DataIStreamoperator>> (std::vector< uint32_t > &value)
 Optimized specialization to read a std::vector of uint32_t. More...
 
template<>
DataIStreamoperator>> (std::vector< int32_t > &value)
 Optimized specialization to read a std::vector of int32_t. More...
 
template<>
DataIStreamoperator>> (std::vector< uint64_t > &value)
 Optimized specialization to read a std::vector of uint64_t. More...
 
template<>
DataIStreamoperator>> (std::vector< int64_t > &value)
 Optimized specialization to read a std::vector of int64_t. More...
 
template<>
DataIStreamoperator>> (std::vector< float > &value)
 Optimized specialization to read a std::vector of float. More...
 
template<>
DataIStreamoperator>> (std::vector< double > &value)
 Optimized specialization to read a std::vector of double. More...
 
template<>
DataIStreamoperator>> (std::vector< ObjectVersion > &value)
 Optimized specialization to read a std::vector of ObjectVersion. More...
 

Friends

CO_API std::ostream & operator<< (std::ostream &, const ICommand &)
 

Additional Inherited Members

- Static Public Member Functions inherited from co::DataIStream
template<class T >
static void swap (T &v)
 Byte-swap a plain data item. More...
 
- Protected Member Functions inherited from co::DataIStream
CO_API DataIStream (const bool swap)
 
 DataIStream (const DataIStream &)
 
virtual CO_API ~DataIStream ()
 

Detailed Description

A class managing received commands.

This class is used by the LocalNode to pass received buffers to the Dispatcher and ultimately command handler functions. It is not intended to be instantiated by applications. The derivates of this ICommand have to be instaniated by the application if the command type requires it. The data retrieval is possible with the provided DataIStream methods or with the templated get() function.

Definition at line 43 of file iCommand.h.

Member Function Documentation

template<typename T >
T co::ICommand::get ( )
inline
Deprecated:
use read()

Definition at line 69 of file iCommand.h.

CO_API uint32_t co::ICommand::getCommand ( ) const
Returns
the command.
Version
1.0
CO_API LocalNodePtr co::ICommand::getLocalNode ( ) const
overridevirtual
Returns
the receiving node.
Version
1.0

Implements co::DataIStream.

NodePtr co::ICommand::getNode ( ) const
inline
Deprecated:
use getRemoteNode()

Definition at line 72 of file iCommand.h.

References getRemoteNode().

+ Here is the call graph for this function:

CO_API NodePtr co::ICommand::getRemoteNode ( ) const
overridevirtual
Returns
the sending node proxy instance.
Version
1.1.1

Implements co::DataIStream.

Referenced by getNode().

+ Here is the caller graph for this function:

CO_API uint64_t co::ICommand::getSize ( ) const
Returns
the command payload size.
Version
1.0
CO_API uint32_t co::ICommand::getType ( ) const
Returns
the command type.
Version
1.0
CO_API bool co::ICommand::isValid ( ) const
Returns
true if the command has valid data.
Version
1.0

The documentation for this class was generated from the following file: