PLObjectManager Class Reference

#include <PLObjectManager.h>

Public Member Functions

 PLObjectManager (char *LogsDirectory)
 ~PLObjectManager ()
HRESULT Close (unsigned int *ResultSize, CRioObject *ObjectRioServer)
RioResult PrefetchBlock (int block, unsigned int BlockSize, RioRequest *RequestRioServer, CRioObject *ObjectRioServer, int ip, RioStreamType traffic=UNICASTTRAFFIC, int port=0)

Private Member Functions

RioResult Read (RioBlock Block, CRioObject *ObjectRioServer, RioRequest *Request, int ip, RioStreamType traffic=UNICASTTRAFFIC, int port=0)

Private Attributes

ofstream m_log

Detailed Description

Definition at line 46 of file PLObjectManager.h.


Constructor & Destructor Documentation

PLObjectManager::PLObjectManager ( char *  LogsDirectory  ) 

Definition at line 37 of file PLObjectManager.cpp.

00038 {
00039     #ifdef RIO_DEBUG1
00040     RioErr << "### [PLObjectManager - Constructor] Start" << endl;
00041     #endif
00042 
00043     #if defined(RIO_DEBUG2) || defined(RIO_EMUL)
00044     // Variavel usada para compor o nome do arquivo com o log.
00045     char LogFileName[ MaxPathSize ];
00046     // Compoe o nome do arquivo com o log.
00047     strcpy( LogFileName, LogsDirectory );
00048     strcat( LogFileName, LOGFILE ); 
00049     m_log.open( LogFileName );
00050     #endif
00051 
00052     #ifdef RIO_DEBUG1
00053     RioErr << "### [PLObjectManager - Constructor] Finish" << endl;
00054     #endif
00055     
00056 }

PLObjectManager::~PLObjectManager (  ) 

Definition at line 59 of file PLObjectManager.cpp.

00060 {
00061     #ifdef RIO_DEBUG1
00062     RioErr << "### [PLObjectManager - Destructor] Start" << endl;
00063     #endif
00064 
00065     #if defined(RIO_DEBUG2) || defined(RIO_EMUL)
00066     m_log.close();
00067     #endif
00068 
00069     #ifdef RIO_DEBUG1
00070     RioErr << "### [PLObjectManager - Destructor] Finish" << endl;
00071     #endif
00072 }


Member Function Documentation

HRESULT PLObjectManager::Close ( unsigned int *  ResultSize,
CRioObject ObjectRioServer 
)

Definition at line 75 of file PLObjectManager.cpp.

00077 {
00078     #ifdef RIO_DEBUG1
00079     RioErr << "### [PLObjectManager - Close] Start" << endl;
00080     #endif
00081 
00082     unsigned int Size;
00083 
00084     // Call method
00085     HRESULT hresult = ObjectRioServer->Close();
00086 
00087     // Check if Result Size is less than Result buffer
00088     Size = MAX_LONG_STRING_SIZE;
00089     if( Size > *ResultSize )
00090     {
00091         #ifdef RIO_DEBUG1
00092         RioErr << "### [PLObjectManager - Close] Finish 1" << endl;
00093         #endif
00094 
00095         return ERROR_CONNECTIONMANAGER + ERROR_RESULT_MESSAGE_OVERFLOW;
00096     }
00097 
00098     #ifdef RIO_DEBUG1
00099     RioErr << "### [PLObjectManager - Close] Finish 2" << endl;
00100     #endif
00101 
00102     return( hresult );
00103 }

RioResult PLObjectManager::PrefetchBlock ( int  block,
unsigned int  BlockSize,
RioRequest RequestRioServer,
CRioObject ObjectRioServer,
int  ip,
RioStreamType  traffic = UNICASTTRAFFIC,
int  port = 0 
)

Definition at line 106 of file PLObjectManager.cpp.

00113 {
00114     #ifdef RIO_DEBUG1
00115     RioErr << "### [PLObjectManager - PrefetchBlock] Start" << endl;
00116     #endif
00117 
00118     RioResult hresult = 0;
00119     RioBlock Block    = block;
00120 
00121     RioObjectSize objectsize;
00122 
00123     ObjectRioServer->GetSize( &objectsize );
00124 
00125     RioBlock NumBlocks = (int) (( (objectsize - 1)/ BlockSize ) + 1);
00126 
00127 //    ObjectRioServer->GetObjectStream()->SetCurPending( 0 );
00128 
00129     if( Block <= ( NumBlocks - 1 ) )
00130     {
00131         hresult = Read( Block,
00132                         ObjectRioServer,
00133                         RequestRioServer,
00134                         ip,
00135                         traffic,
00136                         port );
00137 
00138        if( FAILED( hresult ) )
00139        {
00140            RioErr << "[PLObjectManager]: Failed to read block: " << Block 
00141                   << endl;
00142        }
00143     }
00144 
00145     #ifdef RIO_DEBUG1
00146     RioErr << "### [PLObjectManager - Prefetch Block] Finish" << endl;
00147     #endif
00148 
00149     return( hresult );
00150 }

RioResult PLObjectManager::Read ( RioBlock  Block,
CRioObject ObjectRioServer,
RioRequest Request,
int  ip,
RioStreamType  traffic = UNICASTTRAFFIC,
int  port = 0 
) [private]

Definition at line 153 of file PLObjectManager.cpp.

00159 {
00160     #ifdef RIO_DEBUG1
00161     RioErr << "### [PLObjectManager - Read] Start" << endl;
00162     #endif
00163 
00164     Request->Block        = Block;
00165     Request->Result       = S_OK;
00166     Request->Status       = RIO_REQUEST_FREE;
00167     Request->BufferStatus = 0;
00168 
00169     RioResult hResult = ObjectRioServer->StreamRead( Request, 0, traffic,
00170                                                      ip, port );
00171 
00172     if( FAILED( hResult ) )
00173     {
00174         RioErr << "[PLObjectManager]: Failed to read block: " << Block << endl;
00175     }
00176 
00177     #ifdef RIO_DEBUG1
00178     RioErr << "### [PLObjectManager - Read] Finish" << endl;
00179     #endif
00180 
00181     return( hResult );
00182 }


Field Documentation

ofstream PLObjectManager::m_log [private]

Definition at line 68 of file PLObjectManager.h.


The documentation for this class was generated from the following files:
Generated on Wed Jul 4 16:03:35 2012 for RIO by  doxygen 1.6.3