Main Page   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members   File Members  

CdbSQLObjectId Class Reference

A persistent "object identifier". More...

#include <CdbSQLObjectId.hh>

List of all members.

Public Types

enum  SchemaType { SCHEMA_REGULAR, SCHEMA_PARTITIONABLE }
enum  {
  INVALID_ORIGIN_ID = 0xFFFF, INVALID_CONDITION_ID = 0xFFFF, INVALID_CLUSTER_ID = 0xFFFF, INVALID_PARTITION_ID = 0xFFFF,
  INVALID_INCREMENT_ID = 0xFFFF, INVALID_INDEX = 0xFFFFFFFF
}

Public Member Functions

 CdbSQLObjectId (unsigned short theOriginId=INVALID_ORIGIN_ID, unsigned short theConditionId=INVALID_CONDITION_ID, SchemaType theSchema=SCHEMA_REGULAR, unsigned short theClusterId=INVALID_CLUSTER_ID, unsigned short thePartitionId=INVALID_PARTITION_ID, unsigned short theIncrementId=INVALID_INCREMENT_ID, unsigned int theIndex=INVALID_INDEX)
 Constructor.

unsigned short origin () const
unsigned short condition () const
SchemaType schema () const
unsigned short cluster () const
unsigned short partition () const
unsigned short increment () const
unsigned int index () const
bool isValid () const
 Check the status of an address.

std::string toString () const
 Get a string representation of the identifier.


Static Public Member Functions

CdbSQLObjectId createRegular (unsigned short theOriginId, unsigned short theConditionId, unsigned short theClusterId, unsigned short theIncrementId, unsigned int theIndex)
 A factory method for "REGULAR" condition addresses.

CdbSQLObjectId createPartitionable (unsigned short theOriginId, unsigned short theConditionId, unsigned short theClusterId, unsigned short thePartitionId, unsigned short theIncrementId, unsigned int theIndex)
 A factory method for "PARTITIONABLE" condition addresses.

bool fromString (CdbSQLObjectId &theOutId, const std::string &theInString)
 Translate a string into an object identifier.


Detailed Description

A persistent "object identifier".

In general, the address is defined as follows:

---

For the current implementation the full address has the following layout:

16-bit 16-bit 16-bit 16-bit 16-bit 16-bit 32-bit -------- ----------- -------- --------- ----------- ----------- ------- S<origin>------

Where only two address schemes are supported:

=0 corresponds to "REGULAR" conditions. In that case the value of the parameter is ignored.

=1 corresponds to "PARTITIONABLE" conditions.

Object would be printed as (for example):

"L0-125-R-0-0-1-12567" ("REGULAR") "L257-314-P-0-20-1-56" ("PARTITIONABLE")

Definition at line 38 of file CdbSQLObjectId.hh.


Member Enumeration Documentation

anonymous enum
 

Enumeration values:
INVALID_ORIGIN_ID 
INVALID_CONDITION_ID 
INVALID_CLUSTER_ID 
INVALID_PARTITION_ID 
INVALID_INCREMENT_ID 
INVALID_INDEX 

Definition at line 44 of file CdbSQLObjectId.hh.

enum CdbSQLObjectId::SchemaType
 

Enumeration values:
SCHEMA_REGULAR 
SCHEMA_PARTITIONABLE 

Definition at line 42 of file CdbSQLObjectId.hh.

Referenced by fromString(), and schema().


Constructor & Destructor Documentation

CdbSQLObjectId::CdbSQLObjectId unsigned short    theOriginId = INVALID_ORIGIN_ID,
unsigned short    theConditionId = INVALID_CONDITION_ID,
SchemaType    theSchema = SCHEMA_REGULAR,
unsigned short    theClusterId = INVALID_CLUSTER_ID,
unsigned short    thePartitionId = INVALID_PARTITION_ID,
unsigned short    theIncrementId = INVALID_INCREMENT_ID,
unsigned int    theIndex = INVALID_INDEX
[inline, explicit]
 

Constructor.

Note, that by default it will construct an invalid object address. Use schema specific functory methods defined above instead.

See also:
CdbSQLObjectId::isValid()

Definition at line 128 of file CdbSQLObjectId.hh.

Referenced by createPartitionable(), createRegular(), and fromString().


Member Function Documentation

unsigned short CdbSQLObjectId::cluster   const [inline]
 

Definition at line 148 of file CdbSQLObjectId.hh.

Referenced by CdbMySQL::findPayloadObjectSource(), fromString(), CdbMySQL::setPayloadObjectSource(), and toString().

unsigned short CdbSQLObjectId::condition   const [inline]
 

Definition at line 146 of file CdbSQLObjectId.hh.

Referenced by fromString(), and toString().

CdbSQLObjectId CdbSQLObjectId::createPartitionable unsigned short    theOriginId,
unsigned short    theConditionId,
unsigned short    theClusterId,
unsigned short    thePartitionId,
unsigned short    theIncrementId,
unsigned int    theIndex
[inline, static]
 

A factory method for "PARTITIONABLE" condition addresses.

Definition at line 78 of file CdbSQLObjectId.hh.

References CdbSQLObjectId().

Referenced by CdbMySQLCondition::store_object().

CdbSQLObjectId CdbSQLObjectId::createRegular unsigned short    theOriginId,
unsigned short    theConditionId,
unsigned short    theClusterId,
unsigned short    theIncrementId,
unsigned int    theIndex
[inline, static]
 

A factory method for "REGULAR" condition addresses.

Definition at line 55 of file CdbSQLObjectId.hh.

References CdbSQLObjectId().

Referenced by CdbMySQLCondition::store_object().

bool CdbSQLObjectId::fromString CdbSQLObjectId &    theOutId,
const std::string &    theInString
[static]
 

Translate a string into an object identifier.

The method will make an attempt to translate the specified input string into an identifier. The method will return 'true' and set up an object identifier value upon its successfull completion.

NOTE: Returning the 'true' status doesn't really mean that the returned identifier will be valid. It just means that the input string can be translated into an identifier. That because some variants of the identifier objects can not be valid. And the full constructor defined below does allow creating non-valid object.

See also:
CdbSQLObjectId::isValid()
Parameters:
theOutId  an object identifier to return
theInString  a string to be translate

Definition at line 17 of file CdbSQLObjectId.cc.

References CdbSQLObjectId(), cluster(), condition(), increment(), index(), origin(), partition(), schema(), SCHEMA_PARTITIONABLE, SCHEMA_REGULAR, and SchemaType.

unsigned short CdbSQLObjectId::increment   const [inline]
 

Definition at line 150 of file CdbSQLObjectId.hh.

Referenced by CdbMySQL::findPayloadObjectSource(), fromString(), CdbMySQL::setPayloadObjectSource(), and toString().

unsigned int CdbSQLObjectId::index   const [inline]
 

Definition at line 151 of file CdbSQLObjectId.hh.

Referenced by CdbMySQL::findPayloadObjectSource(), fromString(), CdbMySQL::setPayloadObjectSource(), and toString().

bool CdbSQLObjectId::isValid   const [inline]
 

Check the status of an address.

An address is considered as a NON-valid one only when all its fileds are constructed using their default values.

See also:
CdbSQLObjectId::CdbSQLObjectId()

Definition at line 161 of file CdbSQLObjectId.hh.

References INVALID_CLUSTER_ID, INVALID_CONDITION_ID, INVALID_INCREMENT_ID, INVALID_INDEX, INVALID_ORIGIN_ID, and INVALID_PARTITION_ID.

Referenced by CdbRooDb::createObject(), CdbMySQL::findPayloadObjectSource(), CdbMySQL::setPayloadObjectSource(), and toString().

unsigned short CdbSQLObjectId::origin   const [inline]
 

Definition at line 145 of file CdbSQLObjectId.hh.

Referenced by CdbMySQL::findPayloadObjectSource(), fromString(), CdbMySQL::setPayloadObjectSource(), and toString().

unsigned short CdbSQLObjectId::partition   const [inline]
 

Definition at line 149 of file CdbSQLObjectId.hh.

Referenced by CdbMySQL::findPayloadObjectSource(), fromString(), CdbMySQL::setPayloadObjectSource(), and toString().

SchemaType CdbSQLObjectId::schema   const [inline]
 

Definition at line 147 of file CdbSQLObjectId.hh.

References SchemaType.

Referenced by CdbMySQL::findPayloadObjectSource(), fromString(), CdbMySQL::setPayloadObjectSource(), and toString().

std::string CdbSQLObjectId::toString   const
 

Get a string representation of the identifier.

Definition at line 84 of file CdbSQLObjectId.cc.

References cluster(), condition(), increment(), index(), isValid(), origin(), partition(), schema(), and SCHEMA_REGULAR.

Referenced by CdbRooDbObject::id(), and operator<<().


The documentation for this class was generated from the following files:
Generated on Mon Dec 5 18:22:26 2005 for CDB by doxygen1.3-rc3