PLStreamManager Class Reference

#include <PLStreamManager.h>

Public Member Functions

 PLStreamManager (char *LogsDirectory)
 ~PLStreamManager ()
HRESULT OpenStreamRioServer (RioStreamTraffic Traffic, unsigned int *ResultSize, CRioStream *StreamRioServer, CRioSession *SessionRioServer, int *maxrequests)
HRESULT CloseStreamRioServer (unsigned int *ResultSize, CRioStream *StreamRioServer)
HRESULT Open (char *ObjectName, RioAccess Access, CRioStream *StreamRioServer, CRioObject *ObjectRioServer)
HRESULT OpenCAC (char *ObjectName, RioAccess Access, struct timeval average_RTT, int BufferSize, CRioStream *StreamRioServer, unsigned int *ResultSize, CRioObject *ObjectRioServer)
HRESULT CanStart (CRioStream *StreamRioServer, unsigned int *ResultSize)

Private Attributes

ofstream m_log

Detailed Description

Definition at line 36 of file PLStreamManager.h.


Constructor & Destructor Documentation

PLStreamManager::PLStreamManager ( char *  LogsDirectory  ) 

Definition at line 28 of file PLStreamManager.cpp.

00029 {
00030     #ifdef RIO_DEBUG1
00031     RioErr << "### [PLStreamManager - Constructor] Start" << endl;
00032     #endif
00033 
00034     #if defined(RIO_DEBUG2) || defined(RIO_EMUL)
00035     // Variavel usada para compor o nome do arquivo com o log.
00036     char LogFileName[ MaxPathSize ];
00037     // Compoe o nome do arquivo com o log.
00038     strcpy( LogFileName, LogsDirectory );
00039     strcat( LogFileName, LOGFILE ); 
00040     m_log.open( LogFileName );
00041     #endif
00042 
00043     #ifdef RIO_DEBUG1
00044     RioErr << "### [PLStreamManager - Constructor] Finish" << endl;
00045     #endif
00046 }

PLStreamManager::~PLStreamManager (  ) 

Definition at line 48 of file PLStreamManager.cpp.

00049 {
00050     #ifdef RIO_DEBUG1
00051     RioErr << "### [PLStreamManager - Destructor] Start" << endl;
00052     #endif
00053 
00054     #if defined(RIO_DEBUG2) || defined(RIO_EMUL)
00055     m_log.close();
00056     #endif
00057 
00058     #ifdef RIO_DEBUG1
00059     RioErr << "### [PLStreamManager - Destructor] Finish" << endl;
00060     #endif
00061 }


Member Function Documentation

HRESULT PLStreamManager::CanStart ( CRioStream StreamRioServer,
unsigned int *  ResultSize 
)

Definition at line 266 of file PLStreamManager.cpp.

00268 {
00269     #ifdef RIO_DEBUG1
00270     RioErr << "### [PLStreamManager - CanStart] Start" << endl;
00271     #endif
00272 
00273     unsigned int Size;
00274     int hresult = StreamRioServer->CanStart();
00275 
00276     // Check if Result Size is less than Result buffer
00277     Size = MAX_LONG_STRING_SIZE;
00278     if( Size > *ResultSize )
00279     {
00280         #ifdef RIO_DEBUG1
00281         RioErr << "### [PLStreamManager - CanStart] Finish 1" << endl;
00282         #endif
00283 
00284         return ERROR_PLCONNECTIONMANAGER + ERROR_RESULT_MESSAGE_OVERFLOW;
00285     }
00286 
00287     #ifdef RIO_DEBUG1
00288     RioErr << "### [PLStreamManager - CanStart] Finish 2" << endl;
00289     #endif
00290 
00291     return ( hresult );
00292 }

HRESULT PLStreamManager::CloseStreamRioServer ( unsigned int *  ResultSize,
CRioStream StreamRioServer 
)

Definition at line 150 of file PLStreamManager.cpp.

00152 {
00153     #ifdef RIO_DEBUG1
00154     RioErr << "### [PLStreamManager - CloseStreamRioServer] Start" << endl;
00155     #endif
00156 
00157     unsigned int Size;
00158 
00159     // Call method
00160     HRESULT hresult = StreamRioServer->Close();
00161 
00162     #if defined(RIO_DEBUG2) || defined(RIO_EMUL)
00163     m_log << "OK" << endl;
00164     #endif
00165 
00166     // Check if Result Size is less than Result buffer
00167     Size = MAX_LONG_STRING_SIZE;
00168     if( Size > *ResultSize )
00169     {
00170         #ifdef RIO_DEBUG1
00171         RioErr << "### [PLStreamManager - CloseStreamRioServer] Finish 1" << endl;
00172         #endif
00173 
00174         return ERROR_PLCONNECTIONMANAGER + ERROR_RESULT_MESSAGE_OVERFLOW;
00175     }
00176 
00177     #ifdef RIO_DEBUG1
00178     RioErr << "### [PLStreamManager - CloseStreamRioServer] Finish 2" << endl;
00179     #endif
00180 
00181     return( hresult );
00182 }

HRESULT PLStreamManager::Open ( char *  ObjectName,
RioAccess  Access,
CRioStream StreamRioServer,
CRioObject ObjectRioServer 
)

Definition at line 186 of file PLStreamManager.cpp.

00190 {
00191     #ifdef RIO_DEBUG1
00192     RioErr << "### [PLStreamManager - Open] Start" << endl;
00193     #endif
00194 
00195     HRESULT hresult;
00196 
00197     hresult = ObjectRioServer->Open(ObjectName, Access, StreamRioServer);
00198 
00199     if( FAILED( hresult ) )
00200     {
00201         #if defined(RIO_DEBUG2) || defined(RIO_EMUL)
00202         m_log << " Failed" << endl;
00203         #endif
00204 
00205         #ifdef RIO_DEBUG1
00206         RioErr << "### [PLStreamManager - Open] Finish 1" << endl;
00207         #endif
00208 
00209         return ERROR_PLCONNECTIONMANAGER + ERROR_STREAM_NOT_OPENED;
00210     }
00211 
00212     #if defined(RIO_DEBUG2) || defined(RIO_EMUL)
00213     m_log << " OK" << endl;
00214     #endif
00215 
00216     #ifdef RIO_DEBUG1
00217     RioErr << "### [PLStreamManager - Open] Finish 2" << endl;
00218     #endif
00219 
00220     return ( hresult );
00221 }

HRESULT PLStreamManager::OpenCAC ( char *  ObjectName,
RioAccess  Access,
struct timeval  average_RTT,
int  BufferSize,
CRioStream StreamRioServer,
unsigned int *  ResultSize,
CRioObject ObjectRioServer 
)

Definition at line 224 of file PLStreamManager.cpp.

00231 {
00232     #ifdef RIO_DEBUG1
00233     RioErr << "### [PLStreamManager - OpenCAC] Start" << endl;
00234     #endif
00235 
00236     HRESULT hresult;
00237 
00238     hresult = ObjectRioServer->Open( ObjectName, Access, average_RTT,
00239                                      BufferSize, StreamRioServer, m_log);
00240 
00241     if( FAILED( hresult ) )
00242     {
00243         #if defined(RIO_DEBUG2) || defined(RIO_EMUL)
00244         m_log << " Failed" << endl;
00245         #endif
00246 
00247         #ifdef RIO_DEBUG1
00248         RioErr << "### [PLStreamManager - OpenCAC] Finish 1" << endl;
00249         #endif
00250 
00251         return ERROR_PLCONNECTIONMANAGER + ERROR_CAC_STREAM_NOT_OPENED;
00252     }
00253 
00254     #if defined(RIO_DEBUG2) || defined(RIO_EMUL)
00255     m_log << " OK" << endl;
00256     #endif
00257 
00258     #ifdef RIO_DEBUG1
00259     RioErr << "### [PLStreamManager - OpenCAC] Finish 2" << endl;
00260     #endif
00261 
00262     return ( hresult );
00263 }

HRESULT PLStreamManager::OpenStreamRioServer ( RioStreamTraffic  Traffic,
unsigned int *  ResultSize,
CRioStream StreamRioServer,
CRioSession SessionRioServer,
int *  maxrequests 
)

Definition at line 64 of file PLStreamManager.cpp.

00069 {
00070     #ifdef RIO_DEBUG1
00071     RioErr << "### [PLStreamManager - OpenStreamRioServer] Start" << endl;
00072     #endif
00073 
00074     HRESULT hresult;
00075     unsigned int Size;
00076 
00077     *maxrequests = 0;
00078 
00079     #if defined(RIO_DEBUG2) || defined(RIO_EMUL)
00080     m_log << myInfo() << " Abrindo Stream" << endl;
00081     #endif
00082 
00083     hresult = StreamRioServer->Open( &Traffic, SessionRioServer );
00084     if( FAILED( hresult ) )
00085     {
00086         #if defined(RIO_DEBUG2) || defined(RIO_EMUL)
00087         m_log << myInfo() << " Stream nao pode ser aberta: "
00088               << GetErrorDescription( hresult ) << endl;
00089         #endif
00090 
00091         RioErr << "[OpenStreamRioServer] Error "
00092                << GetErrorDescription( hresult ) << endl;
00093 
00094         #ifdef RIO_DEBUG1
00095         RioErr << "### [PLStreamManager - OpenStreamRioServer] Finish 1" << endl;
00096         #endif
00097 
00098         return ( hresult );
00099     }
00100 
00101     #if defined(RIO_DEBUG2) || defined(RIO_EMUL)
00102     m_log << " OK" << endl;
00103     m_log << "[PLStreamManager]: Max Requests ";
00104     #endif
00105 
00106     int nMaxReq = StreamRioServer->MaxRequests();
00107     if( nMaxReq < 0 )
00108     {
00109         RioErr << "[OpenStreamRioServer] nMaxReq negativo. " << endl;
00110 
00111         #ifdef RIO_DEBUG1
00112         RioErr << "### [PLStreamManager - OpenStreamRioServer] Finish 2" << endl;
00113         #endif
00114 
00115         return ERROR_PLCONNECTIONMANAGER + ERROR_MAX_STREAM_REQUESTS;
00116     }
00117     else
00118     {
00119         *maxrequests = nMaxReq;
00120     }
00121 
00122     #if defined(RIO_DEBUG2) || defined(RIO_EMUL)
00123     m_log << " OK" << endl;
00124     m_log << "[PLStreamManager]: Maxrequests=" << nMaxReq << endl;
00125     #endif
00126 
00127     // Check if Result Size is less than Result buffer
00128     Size = 3 * MAX_LONG_STRING_SIZE;
00129     if( Size > *ResultSize )
00130     {
00131         #ifdef RIO_DEBUG1
00132         RioErr << "### [PLStreamManager - OpenStreamRioServer] Finish 3" << endl;
00133         #endif
00134 
00135         #if defined(RIO_DEBUG2) || defined(RIO_EMUL)
00136         m_log << "[PLStreamManager]: Error: Message overflow." << endl;
00137         #endif
00138 
00139         return ERROR_PLCONNECTIONMANAGER + ERROR_RESULT_MESSAGE_OVERFLOW;
00140     }
00141 
00142     #ifdef RIO_DEBUG1
00143     RioErr << "### [PLStreamManager - OpenStreamRioServer] Finish 4" << endl;
00144     #endif
00145 
00146     return( 0 );
00147 }


Field Documentation

ofstream PLStreamManager::m_log [private]

Definition at line 69 of file PLStreamManager.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