Dapfor home  

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 a 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 data separation from its presentation on the class level. The data object can return unformatted value 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 the data from their 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 takes place in cpp file with the help of the macros DF_BEGIN_FIELD_MAP() and DF_END_FIELD_MAP()

The integer identifiers are used to insert data in 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 the identifiers of base classes can be the same. This can be used for polymorphic behavior of the data object in GUI::CGrid. Each record in the table is presented in the form of the object of CField type. The table itself is represented by the object of CFieldMap class. The table initialization takes place at the start of the application. The table is not changed during the application running, and it allows to organize an access from different threads. In case of a large quantity of the declared fields (more than 50), it is recommended to use DF_END_HASH_FIELD_MAP() instead of the macro DF_END_FIELD_MAP() in order to accelerate the access to class functions by their identifiers.

CDataObject provides CDataObject::ISink callback interface to inform the subscribers about the change of its internal state. AddSink() function is used for subscription for the events. RemoveSink() function should be called to remove the subscribers from CDataObject. Notifications are sent by calling NotifyUpdate(). Realization of the container, which holds the subscriber list, is thread-safe. The function NotifyUpdate() is implemented without taking a synchronization object during the function call. That excludes deadlocks between two and more threads. Usually the function NotifyUpdate is called after the data object's 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? will explain all steps how to install and compile 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 firstly in the last derived class, than in the preceding, etc. up to the first. If the corresponding field is found, CDataObject::Field type object will be 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, which is unchanged during the application running. The access to it is carried out only for field reading. That is why this function is protected against simultaneous access from 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, which is unchanged during the application running. The access to it is carried out only for field reading. That is why this function is protected against simultaneous access from 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, which is unchanged during the application running. The access to it is carried out only for field reading. That is why this function is protected against simultaneous access from 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.

Virtual pure function, which gets the table containing CDataObject fields. Usually this table is declared in the 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, which is unchanged during the application running. The access to it is carried out 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, which is unchanged during the application running. The access to it is carried out 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, which is unchanged during the application running. The access to it is carried out 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, which we can get and set by calling a corresponding function in the derived classes by their identifier

Parameters:
[in] fid Field identifier
Returns:
EnType value.
Thread safety:
CFieldMap is a class attribute, which is unchanged during the application running. The access to it is carried out 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, which is unchanged during the application running. The access to it is carried out 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, which is unchanged during the application running. The access to it is carried out 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 were determined, 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 without synchronizing objects acquisition at the moment of the function call. Thread safety depends on realization 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 were determined, 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 without synchronizing objects acquisition at the moment of the function call. Thread safety depends on realization 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 were determined, 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 without synchronizing objects acquisition at the moment of the function call. Thread safety depends on realization 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 were determined, 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 without synchronizing objects acquisition at the moment of the function call. Thread safety depends on realization 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 were determined, 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 without synchronizing objects acquisition at the moment of the function call. Thread safety depends on realization 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 were determined, 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 without synchronizing objects acquisition at the moment of the function call. Thread safety depends on realization 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 were determined, 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 without synchronizing objects acquisition at the moment of the function call. Thread safety depends on realization 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 were determined, 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 without synchronizing objects acquisition at the moment of the function call. Thread safety depends on realization 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 were determined, 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 without synchronizing objects acquisition at the moment of the function call. Thread safety depends on realization 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 were determined, 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 without synchronizing objects acquisition at the moment of the function call. Thread safety depends on realization 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 were determined, 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 without synchronizing objects acquisition at the moment of the function call. Thread safety depends on realization 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 were determined, 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 without synchronizing objects acquisition at the moment of the function call. Thread safety depends on realization 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 were determined, 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 without synchronizing objects acquisition at the moment of the function call. Thread safety depends on realization 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 were determined, 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 without synchronizing objects acquisition at the moment of the function call. Thread safety depends on realization 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 were determined, 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 without synchronizing objects acquisition at the moment of the function call. Thread safety depends on realization 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 were determined, 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 without synchronizing objects acquisition at the moment of the function call. Thread safety depends on realization 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 were determined, 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 without synchronizing objects acquisition at the moment of the function call. Thread safety depends on realization 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 were determined, 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 without synchronizing objects acquisition at the moment of the function call. Thread safety depends on realization 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 were determined, 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 without synchronizing objects acquisition at the moment of the function call. Thread safety depends on realization 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 were determined, 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 without synchronizing objects acquisition at the moment of the function call. Thread safety depends on realization 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 were determined, 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 without synchronizing objects acquisition at the moment of the function call. Thread safety depends on realization 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 were determined, 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 without synchronizing objects acquisition at the moment of the function call. Thread safety depends on realization 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 were determined, 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 without synchronizing objects acquisition at the moment of the function call. Thread safety depends on realization 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 were determined, 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 without synchronizing objects acquisition at the moment of the function call. Thread safety depends on realization 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 were determined, 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 without synchronizing objects acquisition at the moment of the function call. Thread safety depends on realization 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 were determined, 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 without synchronizing objects acquisition at the moment of the function call. Thread safety depends on realization 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 were determined, 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 without synchronizing objects acquisition at the moment of the function call. Thread safety depends on realization 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 were determined, 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 without synchronizing objects acquisition at the moment of the function call. Thread safety depends on realization 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 were determined, 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 without synchronizing objects acquisition at the moment of the function call. Thread safety depends on realization 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 were determined, 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 without synchronizing objects acquisition at the moment of the function call. Thread safety depends on realization 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. 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 were determined, 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 without synchronizing objects acquisition at the moment of the function call. Thread safety depends on realization of Set-method in these classes.

Reimplemented in CDynamicObject.

const TString & GetSerializationName (  )  const [virtual]

Gets a 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, which 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 excludes 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 to each listener an identificator of the field which was modified. 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. Typically this happens when the destructor of CDataObject is called. Usually the subscribers list should be empty. After callback calls, the function clears the subscription list and its repeated call 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 multithread applications. That is why the main recommendation is to add CDataObject::NotifyDelete call to each destructor in the derived classes.


Copyright Dapfor 2007-2009
Generated on Sat Jan 30 15:01:24 2010 for MFCGrid by doxygen 1.5.5