Public Member Functions | Protected Member Functions | Private Attributes

i_Collection_i Class Reference
[CORBA Interface Definitions]

#include <i_collection_impl.h>

Inheritance diagram for i_Collection_i:
Inheritance graph
Collaboration diagram for i_Collection_i:
Collaboration graph

List of all members.

Public Member Functions

 i_Collection_i ()
CORBA::Any * NextBatch (CORBA::Boolean &a_more)

Protected Member Functions

virtual ~i_Collection_i ()
virtual void PrepareNextBatch (CORBA::Any &a_batch, bool &a_more)
 This is an example of function PrepareNextBatch to demonstrate how the inherited classes prepare data batches.
UInt32_t AllocateInBatch (UInt32_t a_bytes)

Private Attributes

UInt32_t m_freeInBatch
const UInt32_t m_maxBatchSize

Detailed Description

Definition at line 38 of file i_collection_impl.h.

Constructor & Destructor Documentation

i_Collection_i::i_Collection_i (  ) 
i_Collection_i::~i_Collection_i (  )  [protected, virtual]

Definition at line 56 of file i_collection_impl.cpp.

References log_FUNC_m.

Member Function Documentation

UInt32_t i_Collection_i::AllocateInBatch ( UInt32_t  a_bytes  )  [protected]

Definition at line 79 of file i_collection_impl.cpp.

References m_freeInBatch.

Referenced by PrepareNextBatch().

    if (m_freeInBatch > a_bytes) {
        m_freeInBatch -= a_bytes;
        return a_bytes;
    else {
        return 0;

Here is the caller graph for this function:

CORBA::Any * i_Collection_i::NextBatch ( CORBA::Boolean &  a_more  ) 

Definition at line 60 of file i_collection_impl.cpp.

References dbg_DETAIL, log_DBG_m, log_FUNC_m, m_freeInBatch, m_maxBatchSize, and PrepareNextBatch().



    try {
        CORBA::Any_var  retAny(new CORBA::Any);

        m_freeInBatch = m_maxBatchSize;

        PrepareNextBatch(retAny, a_more);

        log_DBG_m(dbg_DETAIL, "Batch size: " << m_maxBatchSize - m_freeInBatch);

        return retAny._retn();


Here is the call graph for this function:

void i_Collection_i::PrepareNextBatch ( CORBA::Any &  a_batch,
bool &  a_more 
) [protected, virtual]

This is an example of function PrepareNextBatch to demonstrate how the inherited classes prepare data batches.

Base class calls this function to prepare each of the batches (sequence of some type of data).

Inherited classes must keep track of the current position in the data that it is sending as a collection.

There is no rule how the data must be prepared: it can be copied from some other sequence, vector; it can be generated on-the-fly or read from a file/database...

a_batch Container for the batch.
a_more Is there more after this batch? Must be set to false for the last batch.

Definition at line 106 of file i_collection_impl.cpp.

References AllocateInBatch(), dbg_NORM, len, log_DBG_m, log_FUNC_m, and str.

Referenced by NextBatch().


    // == General for all implementations ==
    // Batch container of the type that will be used by the CORBA client
    // It must be allocated on heap.
    // Inherited classes will use different sequence type.
    i_StringList_t_var strSeq(new i_StringList_t);

    // == Implementation specific ==
    // Preparation of data. Use AllocateInBatch for each elemnt
    // that is added to the sequence to prevent creating too big batches.
    // AllocateInBatch returns 0 if there is not enough space in the batch
    // to store the next record.
    const char* str ("ABCDEFGHIJKLMNOPQRSTUVZ0123456789");
    size_t len = strlen(str) + 1;

    for (CORBA::ULong i(0); i < 100000; ++i) {

        // Use AllocateInBatch to find out whether there is
        // more room in the batch
        if (AllocateInBatch(len) != 0) {
            strSeq[i] = CORBA::string_dup(str);
        else {

    log_DBG_m(dbg_NORM, "Batch size: " << strSeq->length());

    // == General for all implementations ==
    // Assign prepared sequence to CORBA::Any
    a_batch <<= strSeq._retn();

    // == Implementation specific ==
    // Simple condition for end of data
    static Int32_t count(20);

    if (count < 1) {
    else {

Here is the call graph for this function:

Here is the caller graph for this function:

Member Data Documentation

Reimplemented from i_Component_i.

Definition at line 57 of file i_collection_impl.h.

Definition at line 59 of file i_collection_impl.h.

Referenced by AllocateInBatch(), and NextBatch().

Definition at line 60 of file i_collection_impl.h.

Referenced by NextBatch().

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