Main Page | Class Hierarchy | Class List | Directories | File List | Class Members | File Members | Related Pages | Examples

ArClientArg Class Reference

ArClientArg defines methods for packing/unpacking an ArConfigArg into/from an ArNetPacket. More...

#include <ArClientArgUtils.h>

List of all members.

Public Member Functions

 ArClientArg (bool isDisplayHintParsed=false)
 Constructor.
virtual bool argTextToBuf (const ArConfigArg &arg, ArNetPacket *packet)
 The stored text string is suitable for parsing by an ArArgumentBuilder.
virtual bool argValueToBuf (const ArConfigArg &arg, ArNetPacket *packet)
virtual bool bufToArgValue (ArNetPacket *packet, ArConfigArg &arg)
virtual bool createArg (ArNetPacket *packet, ArConfigArg &argOut)
virtual bool createPacket (const ArConfigArg &arg, ArNetPacket *packet)
virtual bool isSendableParamType (const ArConfigArg &arg)
 Currently, a parameter can only be sent if it is of type INT, DOUBLE, STRING, BOOL, or a SEPARATOR.
virtual ~ArClientArg ()
 Destructor.

Protected Types

enum  { BUFFER_LENGTH = 1024 }

Protected Attributes

char myBuffer [BUFFER_LENGTH]
char myDisplayBuffer [BUFFER_LENGTH]
bool myIsDisplayHintParsed


Detailed Description

ArClientArg defines methods for packing/unpacking an ArConfigArg into/from an ArNetPacket.

(The name of the class is a slight misnomer since it may be used both on the server and client sides.)

The structure of the network packet information is as follows:

    string: arg.getName()
    string: arg.getDescription()
    byte: arg.getConfigPriority()
    byte: arg type ('B' == BOOL | 'I' == INT | 'D' == DOUBLE | 'S' == STRING)
    <arg values>
    string: arg.getDisplayHint() -- only if isDisplayHintParsed is set to true

    <arg values> varies by arg type:
    if BOOL, then:
        byte: arg.getBool()
    if INT, then:
	      byte4: arg.getInt()
		    byte4: arg.getMinInt()
		    byte4: arg.getMaxInt()
    if DOUBLE, then:
	      byte4: arg.getDouble()
		    byte4: arg.getMinDouble()
		    byte4: arg.getMaxDouble()
    if STRING, then:
        string: arg.getString()
 

ArClientArg also defines methods to send an "abbreviated" ArConfigArg (i.e. just value). The short packet structure is as follows:

    <arg value> varies by arg type:
    if BOOL, then:
        byte: arg.getBool()
    if INT, then:
	      byte4: arg.getInt()
    if DOUBLE, then:
	      byte4: arg.getDouble()
    if STRING, then:
        string: arg.getString()
 
Lastly, it defines a method to send an "abbreviated" ArConfigArg in a text format.

Definition at line 86 of file ArClientArgUtils.h.


Member Enumeration Documentation

anonymous enum [protected]
 

Enumeration values:
BUFFER_LENGTH 

Definition at line 163 of file ArClientArgUtils.h.


Constructor & Destructor Documentation

ArClientArg::ArClientArg bool  isDisplayHintParsed = false  ) 
 

Constructor.

Definition at line 37 of file ArClientArgUtils.cpp.

ArClientArg::~ArClientArg  )  [virtual]
 

Destructor.

Definition at line 43 of file ArClientArgUtils.cpp.


Member Function Documentation

bool ArClientArg::argTextToBuf const ArConfigArg arg,
ArNetPacket packet
[virtual]
 

The stored text string is suitable for parsing by an ArArgumentBuilder.

Parameters:
arg the ArConfigArg from which to retrieve the data
packet the ArNetPacket * to which data is added
Returns:
bool set to true if the data was successfully stored in the packet; false if an error occurred and the packet is invalid

Definition at line 413 of file ArClientArgUtils.cpp.

References BUFFER_LENGTH, and myBuffer.

Referenced by ArServerHandlerConfig::getConfigDefaults(), and ArClientHandlerConfig::saveConfigToServer().

bool ArClientArg::argValueToBuf const ArConfigArg arg,
ArNetPacket packet
[virtual]
 

Parameters:
arg the ArConfigArg from which to retrieve the data
packet the ArNetPacket * to which data is added
Returns:
bool set to true if the data was successfully stored in the packet; false if an error occurred and the packet is invalid

Definition at line 367 of file ArClientArgUtils.cpp.

References ArLog::log().

Referenced by ArServerHandlerCameraCollection::setParams().

bool ArClientArg::bufToArgValue ArNetPacket packet,
ArConfigArg arg
[virtual]
 

Parameters:
packet the ArNetPacket * from which data is extracted
argOut the ArConfigArg in which to set the value
Returns:
bool set to true if the data was successfully extracted from the packet; false if an error occurred and argOut is invalid

Definition at line 308 of file ArClientArgUtils.cpp.

References BUFFER_LENGTH, ArLog::log(), and myBuffer.

Referenced by ArServerHandlerCameraCollection::setParams().

bool ArClientArg::createArg ArNetPacket packet,
ArConfigArg argOut
[virtual]
 

Parameters:
packet the ArNetPacket * from which data is extracted
argOut the ArConfigArg in which to set the data
Returns:
bool set to true if the data was successfully extracted from the packet; false if an error occurred and argOut is invalid

Definition at line 62 of file ArClientArgUtils.cpp.

References BUFFER_LENGTH, ArLog::log(), myBuffer, myDisplayBuffer, and myIsDisplayHintParsed.

Referenced by ArClientHandlerConfig::handleGetConfigData().

bool ArClientArg::createPacket const ArConfigArg arg,
ArNetPacket packet
[virtual]
 

Parameters:
arg the ArConfigArg from which to retrieve the data
packet the ArNetPacket * to which data is added
Returns:
bool set to true if the data was successfully stored in the packet; false if an error occurred and the packet is invalid

Definition at line 229 of file ArClientArgUtils.cpp.

References ArLog::log(), and myIsDisplayHintParsed.

Referenced by ArServerHandlerCameraCollection::getCameraList(), and ArServerHandlerConfig::handleGetConfig().

bool ArClientArg::isSendableParamType const ArConfigArg arg  )  [virtual]
 

Currently, a parameter can only be sent if it is of type INT, DOUBLE, STRING, BOOL, or a SEPARATOR.

Definition at line 46 of file ArClientArgUtils.cpp.

Referenced by ArServerHandlerConfig::getConfigDefaults(), ArServerHandlerConfig::handleGetConfig(), and ArClientHandlerConfig::saveConfigToServer().


Member Data Documentation

char ArClientArg::myBuffer[BUFFER_LENGTH] [protected]
 

Definition at line 168 of file ArClientArgUtils.h.

Referenced by argTextToBuf(), bufToArgValue(), and createArg().

char ArClientArg::myDisplayBuffer[BUFFER_LENGTH] [protected]
 

Definition at line 169 of file ArClientArgUtils.h.

Referenced by createArg().

bool ArClientArg::myIsDisplayHintParsed [protected]
 

Definition at line 167 of file ArClientArgUtils.h.

Referenced by createArg(), and createPacket().


The documentation for this class was generated from the following files:
Generated on Tue Feb 20 10:51:51 2007 for ArNetworking by  doxygen 1.4.0