MFC Grid manual

CDataObject Class Reference

Base class for the objects presented in GUI::CGrid. More...

#include <Dapfor/Common/DataObject.h>

Inheritance diagram for CDataObject:

CDelegate CDynamicObject

List of all members.


Public Types

typedef std::pair< CField
*, CDataObject * > 
Field
 This type represents a pair of field and data object where the field is applicable.
typedef std::set< FieldFields
 Set of the fields.
typedef std::set< FID > Fids
 Set of field identifiers.
Get method types
typedef CString(CDataObject::* pfnGetMfcString )() const
 Get-method of the CString type.
typedef TString(CDataObject::* pfnGetStlString )() const
 Get-method of the STL string type.
typedef char(CDataObject::* pfnGetChar )() const
 Get-method of the char type.
typedef unsigned char(CDataObject::* pfnGetUChar )() const
 Get-method of the unsigned char type.
typedef short(CDataObject::* pfnGetShort )() const
 Get-method of the short type.
typedef unsigned short(CDataObject::* pfnGetUShort )() const
 Get-method of the unsigned short type.
typedef long(CDataObject::* pfnGetLong )() const
 Get-method of the long type.
typedef unsigned long(CDataObject::* pfnGetULong )() const
 Get-method of the unsigned long type.
typedef int64(CDataObject::* pfnGetInt64 )() const
 Get-method of the __int64 type.
typedef bool(CDataObject::* pfnGetBool )() const
 Get-method of the bool type.
typedef float(CDataObject::* pfnGetFloat )() const
 Get-method of the float type.
typedef double(CDataObject::* pfnGetDouble )() const
 Get-method of the double type.
typedef CDataObject
*(CDataObject::* 
pfnGetObjectPtr )() const
 Get-method of CDataObject pointer type.
Set method types
typedef void(CDataObject::* pfnSetMfcString )(const CString &)
 Set-method of the CString type.
typedef void(CDataObject::* pfnSetStlString )(const TString &)
 Set-method of the string type.
typedef void(CDataObject::* pfnSetChar )(char)
 Set-method of the char type.
typedef void(CDataObject::* pfnSetUChar )(unsigned char)
 Set-method of the unsigned char type.
typedef void(CDataObject::* pfnSetShort )(short)
 Set-method of the short type.
typedef void(CDataObject::* pfnSetUShort )(unsigned short)
 Set-method of the unsigned short type.
typedef void(CDataObject::* pfnSetLong )(long)
 Set-method of the long type.
typedef void(CDataObject::* pfnSetULong )(unsigned long)
 Set-method of the unsigned long type.
typedef void(CDataObject::* pfnSetInt64 )(int64)
 Set-method of the __int64 type.
typedef void(CDataObject::* pfnSetBool )(bool)
 Set-method of the bool type.
typedef void(CDataObject::* pfnSetFloat )(float)
 Set-method of the float type.
typedef void(CDataObject::* pfnSetDouble )(double)
 Set-method of the double type.
typedef void(CDataObject::* pfnSetObjectPtr )(CDataObject *)
 Set-method of CDataObject pointer type.

Public Member Functions

Field accessors
virtual const Field GetField (FID fid) const
 Gets a field of the data object.
virtual void GetAllFields (Fields &fields) const
 The function copies all the fields declared in the derived classes.
virtual void GetAllFids (Fids &fields) const
 Gets all the integer identifiers supported by the data object.
virtual const CFieldMapGetFieldMap () const =0
 Gets data object fields.
virtual bool HasGetMethod (FID fid) const
 Indicates whether Get- method is presented.
virtual bool HasSetMethod (FID fid) const
 Checks if Set function can be called to set non-formatted value by the specified field identifier.
virtual EnType GetFieldType (FID fid) const
 Gets a field type.
virtual TString GetFieldName (FID fid) const
 Gets a field name, set during CFieldMap initialization.
virtual const CFormatGetFormat (FID fid) const
 Gets format to transmit non-formatted value to the string and back.
Get methods
virtual CString GetMfcString (FID fid) const
 Calls Get-method in the derived class by its field identifier to get CString value.
virtual TString GetStlString (FID fid) const
 Calls Get-method in the derived class by its field identifier to get STL string value.
virtual char GetChar (FID fid) const
 Calls Get-method in the derived class by its field identifier to get char value.
virtual unsigned char GetUChar (FID fid) const
 Calls Get-method in the derived class by its field identifier to get unsigned char value.
virtual short GetShort (FID fid) const
 Calls Get-method in the derived class by its field identifier to get short value.
virtual unsigned short GetUShort (FID fid) const
 Calls Get-method in the derived class by its field identifier to get unsigned short value.
virtual long GetLong (FID fid) const
 Calls Get-method in the derived class by its field identifier to get long value.
virtual unsigned long GetULong (FID fid) const
 Calls Get-method in the derived class by its field identifier to get unsigned long value.
virtual int64 GetInt64 (FID fid) const
 Calls Get-method in the derived class by its field identifier to get __int64 value.
virtual bool GetBool (FID fid) const
 Calls Get-method in the derived class by its field identifier to get bool value.
virtual float GetFloat (FID fid) const
 Calls Get-method in the derived class by its field identifier to get float value.
virtual double GetDouble (FID fid) const
 Calls Get-method in the derived class by its field identifier to get double value.
virtual CDataObjectGetObjectPtr (FID fid) const
 Calls Get-method in the derived class by its field identifier to get CDataObject pointer.
virtual CValue GetValue (FID fid) const
 Calls Get-method in the derived class by its field identifier to get CValue object.
Set methods
virtual bool SetMfcString (FID fid, const CString &val)
 Calls Set-method in the derived class by its field identifier to set CString value.
virtual bool SetStlString (FID fid, const TString &val)
 Calls Set-method in the derived class by its field identifier to set STL string value.
virtual bool SetChar (FID fid, char val)
 Calls Set-method in the derived class by its field identifier to set char value.
virtual bool SetUChar (FID fid, unsigned char val)
 Calls Set-method in the derived class by its field identifier to set unsigned char value.
virtual bool SetShort (FID fid, short val)
 Calls Set-method in the derived class by its field identifier to set short value.
virtual bool SetUShort (FID fid, unsigned short val)
 Calls Set-method in the derived class by its field identifier to set unsigned short value.
virtual bool SetLong (FID fid, long val)
 Calls Set-method in the derived class by its field identifier to set long value.
virtual bool SetULong (FID fid, unsigned long val)
 Calls Set-method in the derived class by its field identifier to set unsigned long value.
virtual bool SetInt64 (FID fid, int64 val)
 Calls Set-method in the derived class by its field identifier to set __int64 value.
virtual bool SetBool (FID fid, bool val)
 Calls Set-method in the derived class by its field identifier to set bool value.
virtual bool SetFloat (FID fid, float val)
 Calls Set-method in the derived class by its field identifier to set float value.
virtual bool SetDouble (FID fid, double val)
 Calls Set-method in the derived class by its field identifier to set double value.
virtual bool SetObjectPtr (FID fid, CDataObject *val)
 Calls Set-method in the derived class by its field identifier to set CDataObject pointer.
virtual bool SetValue (FID fid, const CValue &val)
 Calls Set-method in the derived class by its field identifier to set CValue object.
Formatted strings
virtual CString GetFormattedMfcString (FID fid, const CFormat *defaultFormat) const
 Gets a formatted string by calling corresponding function in the derived class.
virtual bool SetFormattedMfcString (FID fid, const CString &str, const CFormat *defaultFormat)
 Sets a formatted string by calling corresponding function in the derived class.
virtual TString GetFormattedStlString (FID fid, const CFormat *defaultFormat) const
 Gets a formatted string by calling corresponding function in the derived class.
virtual bool SetFormattedStlString (FID fid, const TString &str, const CFormat *defaultFormat)
 Sets a formatted string by calling corresponding function in the derived class.
Serialization
virtual const TString & GetSerializationName () const
 Gets serialization name.
virtual bool IsSerializableType () const
 Indicates whether the object is serializable.
virtual void Serialize (CSerializer &serializer)
 Serializes the object into the serializer.
Notifications
void AddSink (ISink *sink)
 Adds a new listener.
void RemoveSink (ISink *sink)
 Removes a specified listener.
void NotifyUpdate (FID fid)
 Sends notification to the listeners, that the field was changed.
void NotifyUpdate (const Fids &fids)
 Sends notification to the listeners with a list of the modified fields.

Static Public Member Functions

static int GetSerializeVertion ()

Protected Member Functions

void NotifyDelete ()
 Sends the notification, that the object ends its life cycle.

Classes

class  ISink
 Interface to receive notifications from CDataObject. More...

Detailed Description

Base class for the objects presented in GUI::CGrid.

The data object represents the mechanism of separating data from its presentation on the class level. The data object can return unformatted values like char, long, double by calling the appropriate function of the derived class by its integer identifier, and permits to transform unformatted data to the string through the appropriate format and vice-versa. To make separation of data from its presentation possible, the table of functions is organized. These functions can be called by their identifiers. The macro DF_DECLARE_FIELD_MAP() declares this table in the derived class. If there is an inheritance chain, each derived class can organize its own table. The table instantiation occurs in cpp file with DF_BEGIN_FIELD_MAP() and DF_END_FIELD_MAP() macros.

Integer identifiers are used to insert data into the table. Within one table these identifiers should not recur and should not be equal to Common::allFields (-1) or Common:: fieldNotSpecified (-2). If there is an inheritance chain, the identifiers of derived classes and base classes can be the same. This can be used to enable polymorphic behavior of a data object in GUI::CGrid. Each record in the table is presented in the form of an object of CField type. The table itself is represented by the object of CFieldMap class. Table initialization takes place at the start of the application. The table is not changed during the application running, and it enables organizing access from different threads. If there is a large quantity of declared fields (more than 50), it is recommended to use DF_END_HASH_FIELD_MAP() instead of the DF_END_FIELD_MAP() macro in order to accelerate access to class functions by their identifiers.

CDataObject provides CDataObject::ISink callback interface to inform the subscribers about change of its internal state. AddSink() function is used for subscription to the events. RemoveSink() function should be called to remove the subscribers from CDataObject. Notifications are sent by calling NotifyUpdate(). implementation of the container that stores the subscriber list and is thread-safe. NotifyUpdate() function is implemented without taking a synchronization object during function call. This prevents deadlocks between two and more threads. Usually NotifyUpdate function is called after data object state modification.

The data object offers an interface for data serialization. The macro DF_DECLARE_SERIALIZABLE_TYPE() is used to declare a serializable type.

Read What is a data object? article to get more information.

The article How to install the MFC grid and compile the first application? explains all steps of installing and compiling your first application.

Examples

Member Function Documentation

const CDataObject::Field GetField ( FID  fid  )  const [virtual]

Gets a field of the data object.

It performs a field search in the derived classes according to its numeric identifier. When there is a chain of inheritance, the search is performed in the last derived class first, then in the preceding class, etc. up to the first. If the corresponding field is found, CDataObject::Field type object is returned

Parameters:
[in] fid Field identifier
Returns:
CDataObject::Field type object. If the field is found, then both CDataObject and CField objects are returned. Otherwise, CDataObject::Field pair is empty.
thread-safety:
CFieldMap is a class attribute that is unchanged during application execution. It is accessed only for field reading. That is why this function is protected against simultaneous access by different threads. For dynamic object (CDynamicObject) CFieldMap is an object attribute and can be changed at run time. Look CDynamicObject for details.
Note:
The value 'this' is returned as the second parameter of CDataObject::Field pair. However it may be not always correct. For instance, an aggregated object can be returned in CDelegate type object. Anyway it will be the object, to which CField is applicable.

Reimplemented in CDelegate, and CDynamicObject.

void GetAllFields ( Fields fields  )  const [virtual]

The function copies all the fields declared in the derived classes.

Parameters:
[in,out] fields Container, into which all data object fields are copied
thread-safety:
CFieldMap is a class attribute that is unchanged during the application running. It is accessed only for field reading. That is why this function is protected against simultaneous access by different threads. For dynamic object (CDynamicObject) CFieldMap is an object attribute and can be changed at run time. Look CDynamicObject for details.

void GetAllFids ( Fids fids  )  const [virtual]

Gets all the integer identifiers supported by the data object.

Parameters:
[in,out] fids Container, into which identifiers are inserted
thread-safety:
CFieldMap is a class attribute that is unchanged during the application running. It is accessed only for field reading. That is why this function is protected against simultaneous access by different threads. For dynamic object (CDynamicObject) CFieldMap is an object attribute and can be changed at run time. Look CDynamicObject for details.

const CFieldMap * GetFieldMap (  )  const [pure virtual]

Gets data object fields.

Purely virtual function that gets the table containing CDataObject fields. This table is usually declared in derived classes by the macro DF_DECLARE_FIELD_MAP() and is implemented by DF_BEGIN_FIELD_MAP() and DF_END_FIELD_MAP(). This table can be formed for dynamic objects during object creation. Usually the last declared table in hierarchy is returned. CFieldMap::GetParentMap() function can be used to get tables of the basic classes.

Returns:
CFieldMap type object
thread-safety:
CFieldMap is a class attribute that is unchanged during the application running. It is accessed only for field reading. That is why this function is secure for competitive access from different threads. Attention! For dynamic objects (CDynamicObject) field map is an attribute of the object and can be changed at run time.

Implemented in CDynamicObject.

bool HasGetMethod ( FID  fid  )  const [virtual]

Indicates whether Get- method is presented.

Parameters:
[in] fid Field identifier
Returns:
true if Get-method was declared at least in one derived class. Otherwise - false.
thread-safety:
CFieldMap is a class attribute that is unchanged during the application running. It is accessed only for field reading. That is why this function is secure for competitive access from different threads. Attention! For dynamic objects (CDynamicObject) field map is an attribute of the object and can be changed at run time.

Reimplemented in CDynamicObject.

bool HasSetMethod ( FID  fid  )  const [virtual]

Checks if Set function can be called to set non-formatted value by the specified field identifier.

Parameters:
[in] fid Field identifier
Returns:
true if Set-method was declared at least in one derived class. Otherwise - false.
thread-safety:
CFieldMap is a class attribute that is unchanged during the application running. It is accessed only for field reading. That is why this function is secure for competitive access from different threads. Attention! For dynamic objects (CDynamicObject) field map is an attribute of the object and can be changed at run time.

Reimplemented in CDynamicObject.

EnType GetFieldType ( FID  fid  )  const [virtual]

Gets a field type.

Field type is determined by non-formatted value that we can get and set by calling the corresponding function in derived classes by their identifier

Parameters:
[in] fid Field identifier
Returns:
EnType value.
thread-safety:
CFieldMap is a class attribute that is unchanged during the application running. It is accessed only for field reading. That is why this function is secure for competitive access from different threads. Attention! For dynamic objects (CDynamicObject) field map is an attribute of the object and can be changed at run time.

Reimplemented in CDynamicObject.

TString GetFieldName ( FID  fid  )  const [virtual]

Gets a field name, set during CFieldMap initialization.

Parameters:
[in] fid Field identifier
Returns:
Field name.
thread-safety:
CFieldMap is a class attribute that is unchanged during the application running. It is accessed only for field reading. That is why this function is secure for competitive access from different threads. Attention! For dynamic objects (CDynamicObject) field map is an attribute of the object and can be changed at run time.

Reimplemented in CDynamicObject.

const CFormat * GetFormat ( FID  fid  )  const [virtual]

Gets format to transmit non-formatted value to the string and back.

Parameters:
[in] fid Field identifier
Returns:
CFormat type object if the field exists. Otherwise 0
thread-safety:
CFieldMap is a class attribute that is unchanged during the application running. It is accessed only for field reading. That is why this function is secure for competitive access from different threads. Attention! For dynamic objects (CDynamicObject) field map is an attribute of the object and can be changed at run time.

Reimplemented in CDynamicObject.

TString GetStlString ( FID  fid  )  const [virtual]

Calls Get-method in the derived class by its field identifier to get STL string value.

The function is trying to get string type non-formatted value. For this purpose a corresponding function is searched by the integer identifier in the derived classes. If equal identifiers for different classes in a chain of inheritance are discovered, then the last class function is called.

Parameters:
[in] fid Field identifier
Returns:
non-formatted string value
thread-safety:
The functions search and call in the derived classes are thread-safe operations that don't lock synchronizing objects on function call. thread-safety depends on implementation of Set-method in these classes.

Reimplemented in CDynamicObject.

char GetChar ( FID  fid  )  const [virtual]

Calls Get-method in the derived class by its field identifier to get char value.

The function is trying to get char type non-formatted value. For this purpose a corresponding function is searched by the integer identifier in the derived classes. If equal identifiers for different classes in a chain of inheritance are discovered, then the last class function is called.

Parameters:
[in] fid Field identifier
Returns:
non-formatted char value
thread-safety:
The functions search and call in the derived classes are thread-safe operations that don't lock synchronizing objects on function call. thread-safety depends on implementation of Set-method in these classes.

Reimplemented in CDynamicObject.

unsigned char GetUChar ( FID  fid  )  const [virtual]

Calls Get-method in the derived class by its field identifier to get unsigned char value.

The function is trying to get unsigned char type non-formatted value. For this purpose a corresponding function is searched by the integer identifier in the derived classes. If equal identifiers for different classes in a chain of inheritance are discovered, then the last class function is called.

Parameters:
[in] fid Field identifier
Returns:
non-formatted unsigned char value
thread-safety:
The functions search and call in the derived classes are thread-safe operations that don't lock synchronizing objects on function call. thread-safety depends on implementation of Set-method in these classes.

Reimplemented in CDynamicObject.

short GetShort ( FID  fid  )  const [virtual]

Calls Get-method in the derived class by its field identifier to get short value.

The function is trying to get short type non-formatted value. For this purpose a corresponding function is searched by the integer identifier in the derived classes. If equal identifiers for different classes in a chain of inheritance are discovered, then the last class function is called.

Parameters:
[in] fid Field identifier
Returns:
non-formatted short value
thread-safety:
The functions search and call in the derived classes are thread-safe operations that don't lock synchronizing objects on function call. thread-safety depends on implementation of Set-method in these classes.

Reimplemented in CDynamicObject.

unsigned short GetUShort ( FID  fid  )  const [virtual]

Calls Get-method in the derived class by its field identifier to get unsigned short value.

The function is trying to get unsigned short type non-formatted value. For this purpose a corresponding function is searched by the integer identifier in the derived classes. If equal identifiers for different classes in a chain of inheritance are discovered, then the last class function is called.

Parameters:
[in] fid Field identifier
Returns:
non-formatted unsigned short value
thread-safety:
The functions search and call in the derived classes are thread-safe operations that don't lock synchronizing objects on function call. thread-safety depends on implementation of Set-method in these classes.

Reimplemented in CDynamicObject.

long GetLong ( FID  fid  )  const [virtual]

Calls Get-method in the derived class by its field identifier to get long value.

The function is trying to get long type non-formatted value. For this purpose a corresponding function is searched by the integer identifier in the derived classes. If equal identifiers for different classes in a chain of inheritance are discovered, then the last class function is called.

Parameters:
[in] fid Field identifier
Returns:
non-formatted long value
thread-safety:
The functions search and call in the derived classes are thread-safe operations that don't lock synchronizing objects on function call. thread-safety depends on implementation of Set-method in these classes.

Reimplemented in CDynamicObject.

unsigned long GetULong ( FID  fid  )  const [virtual]

Calls Get-method in the derived class by its field identifier to get unsigned long value.

The function is trying to get unsigned long type non-formatted value. For this purpose a corresponding function is searched by the integer identifier in the derived classes. If equal identifiers for different classes in a chain of inheritance are discovered, then the last class function is called.

Parameters:
[in] fid Field identifier
Returns:
non-formatted unsigned long value
thread-safety:
The functions search and call in the derived classes are thread-safe operations that don't lock synchronizing objects on function call. thread-safety depends on implementation of Set-method in these classes.

Reimplemented in CDynamicObject.

int64 GetInt64 ( FID  fid  )  const [virtual]

Calls Get-method in the derived class by its field identifier to get __int64 value.

The function is trying to get __int64 type non-formatted value. For this purpose a corresponding function is searched by the integer identifier in the derived classes. If equal identifiers for different classes in a chain of inheritance are discovered, then the last class function is called.

Parameters:
[in] fid Field identifier
Returns:
non-formatted __int64 value
thread-safety:
The functions search and call in the derived classes are thread-safe operations that don't lock synchronizing objects on function call. thread-safety depends on implementation of Set-method in these classes.

Reimplemented in CDynamicObject.

bool GetBool ( FID  fid  )  const [virtual]

Calls Get-method in the derived class by its field identifier to get bool value.

The function is trying to get bool type non-formatted value. For this purpose a corresponding function is searched by the integer identifier in the derived classes. If equal identifiers for different classes in a chain of inheritance are discovered, then the last class function is called.

Parameters:
[in] fid Field identifier
Returns:
non-formatted bool value
thread-safety:
The functions search and call in the derived classes are thread-safe operations that don't lock synchronizing objects on function call. thread-safety depends on implementation of Set-method in these classes.

Reimplemented in CDynamicObject.

float GetFloat ( FID  fid  )  const [virtual]

Calls Get-method in the derived class by its field identifier to get float value.

The function is trying to get float type non-formatted value. For this purpose a corresponding function is searched by the integer identifier in the derived classes. If equal identifiers for different classes in a chain of inheritance are discovered, then the last class function is called.

Parameters:
[in] fid Field identifier
Returns:
non-formatted float value
thread-safety:
The functions search and call in the derived classes are thread-safe operations that don't lock synchronizing objects on function call. thread-safety depends on implementation of Set-method in these classes.

Reimplemented in CDynamicObject.

double GetDouble ( FID  fid  )  const [virtual]

Calls Get-method in the derived class by its field identifier to get double value.

The function is trying to get double type non-formatted value. For this purpose a corresponding function is searched by the integer identifier in the derived classes. If equal identifiers for different classes in a chain of inheritance are discovered, then the last class function is called.

Parameters:
[in] fid Field identifier
Returns:
non-formatted double value
thread-safety:
The functions search and call in the derived classes are thread-safe operations that don't lock synchronizing objects on function call. thread-safety depends on implementation of Set-method in these classes.

Reimplemented in CDynamicObject.

CDataObject * GetObjectPtr ( FID  fid  )  const [virtual]

Calls Get-method in the derived class by its field identifier to get CDataObject pointer.

The function is trying to get CDataObject pointer. For this purpose a corresponding function is searched by the integer identifier in the derived classes. If equal identifiers for different classes in a chain of inheritance are discovered, then the last class function is called.

Parameters:
[in] fid Field identifier
Returns:
CDataObject pointer
thread-safety:
The functions search and call in the derived classes are thread-safe operations that don't lock synchronizing objects on function call. thread-safety depends on implementation of Set-method in these classes.

Reimplemented in CDynamicObject.

CValue GetValue ( FID  fid  )  const [virtual]

Calls Get-method in the derived class by its field identifier to get CValue object.

The function is trying to get CValue type non-formatted value. For this purpose a corresponding function is searched by the integer identifier in the derived classes. If equal identifiers for different classes in a chain of inheritance are discovered, then the last class function is called.

Parameters:
[in] fid Field identifier
Returns:
non-formatted CValue object
thread-safety:
The functions search and call in the derived classes are thread-safe operations that don't lock synchronizing objects on function call. thread-safety depends on implementation of Set-method in these classes.

Reimplemented in CDynamicObject.

bool SetMfcString ( FID  fid,
const CString &  val 
) [virtual]

Calls Set-method in the derived class by its field identifier to set CString value.

The function is trying to set MFC string non-formatted value. For this purpose a corresponding function is searched by the integer identifier in the derived classes. If equal identifiers for different classes in a chain of inheritance are discovered, then the last class function is called.

Parameters:
[in] fid Field identifier
[in] val Unformatted string
Returns:
True if the function in the derived class has been successfully called. Otherwise - false.
thread-safety:
The functions search and call in the derived classes are thread-safe operations that don't lock synchronizing objects on function call. thread-safety depends on implementation of Set-method in these classes.

Reimplemented in CDynamicObject.

bool SetStlString ( FID  fid,
const TString &  val 
) [virtual]

Calls Set-method in the derived class by its field identifier to set STL string value.

The function is trying to set STL string non-formatted value. For this purpose a corresponding function is searched by the integer identifier in the derived classes. If equal identifiers for different classes in a chain of inheritance are discovered, then the last class function is called.

Parameters:
[in] fid Field identifier
[in] val Unformatted string
Returns:
True if the function in the derived class has been successfully called. Otherwise - false.
thread-safety:
The functions search and call in the derived classes are thread-safe operations that don't lock synchronizing objects on function call. thread-safety depends on implementation of Set-method in these classes.

Reimplemented in CDynamicObject.

bool SetChar ( FID  fid,
char  val 
) [virtual]

Calls Set-method in the derived class by its field identifier to set char value.

The function is trying to set char type non-formatted value. For this purpose a corresponding function is searched by the integer identifier in the derived classes. If equal identifiers for different classes in a chain of inheritance are discovered, then the last class function is called.

Parameters:
[in] fid Field identifier
[in] val Unformatted value
Returns:
True if the function in the derived class has been successfully called. Otherwise - false.
thread-safety:
The functions search and call in the derived classes are thread-safe operations that don't lock synchronizing objects on function call. thread-safety depends on implementation of Set-method in these classes.

Reimplemented in CDynamicObject.

bool SetUChar ( FID  fid,
unsigned char  val 
) [virtual]

Calls Set-method in the derived class by its field identifier to set unsigned char value.

The function is trying to set unsigned char type non-formatted value. For this purpose a corresponding function is searched by the integer identifier in the derived classes. If equal identifiers for different classes in a chain of inheritance are discovered, then the last class function is called.

Parameters:
[in] fid Field identifier
[in] val Unformatted value
Returns:
True if the function in the derived class has been successfully called. Otherwise - false.
thread-safety:
The functions search and call in the derived classes are thread-safe operations that don't lock synchronizing objects on function call. thread-safety depends on implementation of Set-method in these classes.

Reimplemented in CDynamicObject.

bool SetShort ( FID  fid,
short  val 
) [virtual]

Calls Set-method in the derived class by its field identifier to set short value.

The function is trying to set short type non-formatted value. For this purpose a corresponding function is searched by the integer identifier in the derived classes. If equal identifiers for different classes in a chain of inheritance are discovered, then the last class function is called.

Parameters:
[in] fid Field identifier
[in] val Unformatted value
Returns:
True if the function in the derived class has been successfully called. Otherwise - false.
thread-safety:
The functions search and call in the derived classes are thread-safe operations that don't lock synchronizing objects on function call. thread-safety depends on implementation of Set-method in these classes.

Reimplemented in CDynamicObject.

bool SetUShort ( FID  fid,
unsigned short  val 
) [virtual]

Calls Set-method in the derived class by its field identifier to set unsigned short value.

The function is trying to set unsigned short type non-formatted value. For this purpose a corresponding function is searched by the integer identifier in the derived classes. If equal identifiers for different classes in a chain of inheritance are discovered, then the last class function is called.

Parameters:
[in] fid Field identifier
[in] val Unformatted value
Returns:
True if the function in the derived class has been successfully called. Otherwise - false.
thread-safety:
The functions search and call in the derived classes are thread-safe operations that don't lock synchronizing objects on function call. thread-safety depends on implementation of Set-method in these classes.

Reimplemented in CDynamicObject.

bool SetLong ( FID  fid,
long  val 
) [virtual]

Calls Set-method in the derived class by its field identifier to set long value.

The function is trying to set long type non-formatted value. For this purpose a corresponding function is searched by the integer identifier in the derived classes. If equal identifiers for different classes in a chain of inheritance are discovered, then the last class function is called.

Parameters:
[in] fid Field identifier
[in] val Unformatted value
Returns:
True if the function in the derived class has been successfully called. Otherwise - false.
thread-safety:
The functions search and call in the derived classes are thread-safe operations that don't lock synchronizing objects on function call. thread-safety depends on implementation of Set-method in these classes.

Reimplemented in CDynamicObject.

bool SetULong ( FID  fid,
unsigned long  val 
) [virtual]

Calls Set-method in the derived class by its field identifier to set unsigned long value.

The function is trying to set unsigned long type non-formatted value. For this purpose a corresponding function is searched by the integer identifier in the derived classes. If equal identifiers for different classes in a chain of inheritance are discovered, then the last class function is called.

Parameters:
[in] fid Field identifier
[in] val Unformatted value
Returns:
True if the function in the derived class has been successfully called. Otherwise - false.
thread-safety:
The functions search and call in the derived classes are thread-safe operations that don't lock synchronizing objects on function call. thread-safety depends on implementation of Set-method in these classes.

Reimplemented in CDynamicObject.

bool SetInt64 ( FID  fid,
int64  val 
) [virtual]

Calls Set-method in the derived class by its field identifier to set __int64 value.

The function is trying to set __int64 type non-formatted value. For this purpose a corresponding function is searched by the integer identifier in the derived classes. If equal identifiers for different classes in a chain of inheritance are discovered, then the last class function is called.

Parameters:
[in] fid Field identifier
[in] val Unformatted value
Returns:
True if the function in the derived class has been successfully called. Otherwise - false.
thread-safety:
The functions search and call in the derived classes are thread-safe operations that don't lock synchronizing objects on function call. thread-safety depends on implementation of Set-method in these classes.

Reimplemented in CDynamicObject.

bool SetBool ( FID  fid,
bool  val 
) [virtual]

Calls Set-method in the derived class by its field identifier to set bool value.

The function is trying to set bool type non-formatted value. For this purpose a corresponding function is searched by the integer identifier in the derived classes. If equal identifiers for different classes in a chain of inheritance are discovered, then the last class function is called.

Parameters:
[in] fid Field identifier
[in] val Unformatted value
Returns:
True if the function in the derived class has been successfully called. Otherwise - false.
thread-safety:
The functions search and call in the derived classes are thread-safe operations that don't lock synchronizing objects on function call. thread-safety depends on implementation of Set-method in these classes.

Reimplemented in CDynamicObject.

bool SetFloat ( FID  fid,
float  val 
) [virtual]

Calls Set-method in the derived class by its field identifier to set float value.

The function is trying to set float type non-formatted value. For this purpose a corresponding function is searched by the integer identifier in the derived classes. If equal identifiers for different classes in a chain of inheritance are discovered, then the last class function is called.

Parameters:
[in] fid Field identifier
[in] val Unformatted value
Returns:
True if the function in the derived class has been successfully called. Otherwise - false.
thread-safety:
The functions search and call in the derived classes are thread-safe operations that don't lock synchronizing objects on function call. thread-safety depends on implementation of Set-method in these classes.

Reimplemented in CDynamicObject.

bool SetDouble ( FID  fid,
double  val 
) [virtual]

Calls Set-method in the derived class by its field identifier to set double value.

The function is trying to set double type non-formatted value. For this purpose a corresponding function is searched by the integer identifier in the derived classes. If equal identifiers for different classes in a chain of inheritance are discovered, then the last class function is called.

Parameters:
[in] fid Field identifier
[in] val Unformatted value
Returns:
True if the function in the derived class has been successfully called. Otherwise - false.
thread-safety:
The functions search and call in the derived classes are thread-safe operations that don't lock synchronizing objects on function call. thread-safety depends on implementation of Set-method in these classes.

Reimplemented in CDynamicObject.

bool SetObjectPtr ( FID  fid,
CDataObject val 
) [virtual]

Calls Set-method in the derived class by its field identifier to set CDataObject pointer.

The function is trying to set pointer to the CDataObject value. For this purpose a corresponding function is searched by the integer identifier in the derived classes. If equal identifiers for different classes in a chain of inheritance are discovered, then the last class function is called.

Parameters:
[in] fid Field identifier
[in] val Unformatted value
Returns:
True if the function in the derived class has been successfully called. Otherwise - false.
thread-safety:
The functions search and call in the derived classes are thread-safe operations that don't lock synchronizing objects on function call. thread-safety depends on implementation of Set-method in these classes.

Reimplemented in CDynamicObject.

bool SetValue ( FID  fid,
const CValue val 
) [virtual]

Calls Set-method in the derived class by its field identifier to set CValue object.

The function is trying to set CValue type non-formatted value. For this purpose a corresponding function is searched by the integer identifier in the derived classes. If equal identifiers for different classes in a chain of inheritance are discovered, then the last class function is called.

Parameters:
[in] fid Field identifier
[in] val Unformatted value
Returns:
True if the function in the derived class has been successfully called. Otherwise - false.
thread-safety:
The functions search and call in the derived classes are thread-safe operations that don't lock synchronizing objects on function call. thread-safety depends on implementation of Set-method in these classes.

Reimplemented in CDynamicObject.

CString GetFormattedMfcString ( FID  fid,
const CFormat defaultFormat 
) const [virtual]

Gets a formatted string by calling corresponding function in the derived class.

The function is trying to get a formatted MFC string for the specified field. For this purpose a corresponding function is searched by the integer identifier in the derived classes. If equal identifiers for different classes in a chain of inheritance are discovered, then the last class function is called. After, the value is transformed via the format to the formatted string.

Parameters:
[in] fid Field identifier
[in] defaultFormat Format to transmit value to a formatted string. If the format is not specified, default format will be used, taken by CFormat::GetDefaultFormat() function call.
Returns:
Formatted string in case of success, otherwise - empty string.
thread-safety:
The functions search and call in the derived classes are thread-safe operations that don't lock synchronizing objects on function call. thread-safety depends on implementation of Set-method in these classes.

Reimplemented in CDynamicObject.

bool SetFormattedMfcString ( FID  fid,
const CString &  str,
const CFormat defaultFormat 
) [virtual]

Sets a formatted string by calling corresponding function in the derived class.

The function is trying to set formatted MFC string to the specified field. For this purpose the formatted string is transformed via the format to the unformatted value. Then, a corresponding function is searched by the integer identifier in the derived classes. If equal identifiers for different classes in a chain of inheritance are discovered, then the last class function is called.

Parameters:
[in] fid Field identifier
[in] str Formatted string
[in] defaultFormat Format to get value from the formatted string. If the format is not specified, default format will be used, taken by CFormat::GetDefaultFormat() function call.
Returns:
True if the function in the derived class has been successfully called. Otherwise - false.
thread-safety:
The functions search and call in the derived classes are thread-safe operations that don't lock synchronizing objects on function call. thread-safety depends on implementation of Set-method in these classes.

Reimplemented in CDynamicObject.

TString GetFormattedStlString ( FID  fid,
const CFormat defaultFormat 
) const [virtual]

Gets a formatted string by calling corresponding function in the derived class.

The function is trying to get a formatted STL string for the specified field. For this purpose a corresponding function is searched by the integer identifier in the derived classes. If equal identifiers for different classes in a chain of inheritance are discovered, then the last class function is called. After, the value is transformed via the format to the formatted string.

Parameters:
[in] fid Field identifier
[in] defaultFormat Format to transmit value to a formatted string. If the format is not specified, default format will be used, taken by CFormat::GetDefaultFormat() function call.
Returns:
Formatted string in case of success, otherwise - empty string.
thread-safety:
The functions search and call in the derived classes are thread-safe operations that don't lock synchronizing objects on function call. thread-safety depends on implementation of Set-method in these classes.

Reimplemented in CDynamicObject.

bool SetFormattedStlString ( FID  fid,
const TString &  str,
const CFormat defaultFormat 
) [virtual]

Sets a formatted string by calling corresponding function in the derived class.

The function is trying to set formatted STL string to the specified field. For this purpose the formatted string is transformed via the format to the unformatted value. After that, a corresponding function is searched by the integer identifier in the derived classes. If equal identifiers for different classes in a chain of inheritance are discovered, then the last class function is called.

Parameters:
[in] fid Field identifier
[in] str Formatted string
[in] defaultFormat Format to get value from the formatted string. If the format is not specified, default format will be used, taken by CFormat::GetDefaultFormat() function call.
Returns:
True if the function in the derived class has been successfully called. Otherwise - false.
thread-safety:
The functions search and call in the derived classes are thread-safe operations that don't lock synchronizing objects on function call. thread-safety depends on implementation of Set-method in these classes.

Reimplemented in CDynamicObject.

const TString & GetSerializationName (  )  const [virtual]

Gets serialization name.

The macro DF_DECLARE_SERIALIZABLE_TYPE() may be used to declare class as serializable.

Returns:
Class name

bool IsSerializableType (  )  const [virtual]

Indicates whether the object is serializable.

The macro DF_DECLARE_SERIALIZABLE_TYPE() may be used to declare class as serializable.

Returns:
true if the object is serializable. Otherwise false.

void Serialize ( CSerializer serializer  )  [virtual]

Serializes the object into the serializer.

Serializes the object to the serializer. To reduce Common library dependence on external libraries (including MFC) CSerializer class have been added that resembles CArchive class, existing in MFC library.

Parameters:
[in] serializer An object, into which data object is serialized. Serialization direction is determined by CSerializer::GetMode() function.

int GetSerializeVertion (  )  [static]

Returns current serialization version of CDataObject class.

Returns:
version identifier.

void AddSink ( ISink sink  ) 

Adds a new listener.

The function adds a subscriber to subscription list. The subscriber gets notification when CDataObject::NotifyUpdate or CDataObject::NotifyDelete functions are called (typically during Set- function call or in the destructor of CDataObject). The subscribtion list is protected against multiple threads accessing. The functions CDataObject::AddSink, CDataObject::RemoveSink, CDataObject::NotifyUpdate and CDataObject::NotifyDelete are thread-safe. CDataObject notifies the listeners without critical section or mutex objects taking at the moment of notification that prevents dead-lock between two or more threads.

Parameters:
[in] sink Callback interface to receive notifications. During insertion it is checked if the specified interface wasn't inserted before. If it has been already inserted, repeated insertion does not occur.
thread-safety:
The function is thread-safe

void RemoveSink ( ISink sink  ) 

Removes a specified listener.

Parameters:
[in] sink Callback interface to remove from the subscription list.
thread-safety:
The function is thread-safe.

void NotifyUpdate ( FID  fid  ) 

Sends notification to the listeners, that the field was changed.

The function sends identifier of the field which was modified to each listener. Typically this happens when Set- function of CDataObject is called.

Parameters:
[in] fid Field identificator.
thread-safety:
The function is thread-safe. The subscribtion list is protected against multiple threads accessing. When the function is called, the listeners are notified without critical section or mutex objects taking at the moment of notification. This approach permits to exclude dead-lock possibility between two or more threads.

void NotifyUpdate ( const Fids fids  ) 

Sends notification to the listeners with a list of the modified fields.

The function sends to each listener a list of field identificators. Typically this happens when Set- functions of CDataObject are called.

Parameters:
[in] fids List of field identificators.
thread-safety:
The function is thread-safe. The subscribtion list is protected against multiple threads accessing. When the function is called, the listeners are notified without critical section or mutex objects taking at the moment of notification. This approach permits to exclude dead-lock possibility between two or more threads.

void NotifyDelete (  )  [protected]

Sends the notification, that the object ends its life cycle.

The function notifies the remained subscribers on CDataObject life ending. This usually happens when the destructor of CDataObject is called. The subscribers list is usually empty. After callback the function clears the subscription list and its repeated calls will be ineffective.

thread-safety:
The function is thread-safe. The subscribtion list is protected against multiple threads accessing. When the function is called, the listeners are notified without critical section or mutex objects taking at the moment of notification. This approach permits to exclude dead-lock possibility between two or more threads.
Note:
CDataObject in its virtual destructor calls CDataObject::NotifyDelete. Taking into account destructor calling order, all methods in the derived classes will be invalid at the moment of the call. If any of these methods are called, pure virtual function call exception will be raised. The same effect can be marked in case of multithreaded applications. That is why the main recommendation is to add CDataObject::NotifyDelete call to each destructor in the derived classes.