📄 giopstream.h
字号:
inline CommFailure& operator=(const CommFailure& e) { pd_minor = e.pd_minor; pd_status = e.pd_status; pd_retry = e.pd_retry; pd_filename = e.pd_filename; pd_linenumber = e.pd_linenumber; return *this; } static void _raise(CORBA::ULong minor, CORBA::CompletionStatus status, CORBA::Boolean retry, const char* filename, CORBA::ULong linenumber); private: CORBA::ULong pd_minor; CORBA::CompletionStatus pd_status; CORBA::Boolean pd_retry; const char* pd_filename; CORBA::ULong pd_linenumber; }; //////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////// static void dumpbuf(unsigned char* buf, size_t sz); // Dump the buffer to the log. Logs just the first 128 bytes unless // omniORB::traceLevel >= 40.protected: giopStrand* pd_strand; CORBA::Boolean pd_rdlocked; CORBA::Boolean pd_wrlocked; giopStreamImpl* pd_impl; unsigned long pd_deadline_secs; unsigned long pd_deadline_nanosecs;private: giopStream(); giopStream(const giopStream&); giopStream& operator=(const giopStream&);public: // These tunable parameters are used to determine at what size an // octet array will be sent/received directly to/from the network // connection without staging through the internal buffer. static _core_attr CORBA::ULong directSendCutOff; static _core_attr CORBA::ULong directReceiveCutOff; static _core_attr CORBA::ULong bufferSize; // Allocate this number of bytes for each giopStream_Buffer.public: // The following implement the abstract functions defined in cdrStream // // In addition to the CORBA SystemException, the member functions will // raise the giopStream::CommFailure instead of CORBA::COMM_FAILURE exception // to indicate an error in sending or receiving data. void put_octet_array(const _CORBA_Octet* b, int size, omni::alignment_t align=omni::ALIGN_1); void get_octet_array(_CORBA_Octet* b,int size, omni::alignment_t align=omni::ALIGN_1); void skipInput(_CORBA_ULong); _CORBA_Boolean checkInputOverrun(_CORBA_ULong, _CORBA_ULong, omni::alignment_t align=omni::ALIGN_1); _CORBA_Boolean checkOutputOverrun(_CORBA_ULong,_CORBA_ULong, omni::alignment_t align=omni::ALIGN_1); void fetchInputData(omni::alignment_t,size_t); _CORBA_Boolean reserveOutputSpaceForPrimitiveType(omni::alignment_t,size_t); _CORBA_Boolean maybeReserveOutputSpace(omni::alignment_t,size_t); _CORBA_Boolean is_giopStream(); _CORBA_ULong currentInputPtr() const; _CORBA_ULong currentOutputPtr() const; friend class giopImpl10; friend class giopImpl11; friend class giopImpl12; //////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////// // Receiving GIOP messages: // GIOP messages are read from the strand via the member function // inputMessage() and inputChunk(). Both functions return a // giopStream_Buffer. The buffer should be returned to the strand using // the releaseInputBuffer() function. // // struct giopStream_Buffer { // CORBA::ULong start; /* offset to the beginning of data */ // CORBA::ULong end; /* offset to the end of buffer */ // CORBA::ULong last; /* offset to the last data byte */ // CORBA::ULong size; /* GIOP message size. */ // inputBuffer* next; /* next inputBuffer in a chain */ // buffer data to follows. // static void deleteBuffer(inputBuffer*); // }; giopStream_Buffer* newInputBuffer(CORBA::ULong sz=0); // Return a giopStream_Buffer. Should be deleted by callingprivate: // The following variables must be initialised to 0 by reset(). giopStream_Buffer* pd_currentInputBuffer; giopStream_Buffer* pd_input; CORBA::Boolean pd_inputFullyBuffered; CORBA::Boolean pd_inputMatchedId; // The following variables can be left uninitialised and will be // written with a sensible value when used. CORBA::Boolean pd_inputExpectAnotherFragment; CORBA::ULong pd_inputFragmentToCome; CORBA::ULong pd_inputMessageSize; inline CORBA::Boolean inputFullyBuffered() const { return pd_inputFullyBuffered; } inline void inputFullyBuffered(CORBA::Boolean b) { pd_inputFullyBuffered = b; } inline CORBA::Boolean inputExpectAnotherFragment() const { return pd_inputExpectAnotherFragment; } inline void inputExpectAnotherFragment(CORBA::Boolean yes ) { pd_inputExpectAnotherFragment = yes; } inline CORBA::Boolean inputMatchedId() const { return pd_inputMatchedId; } inline void inputMatchedId(CORBA::Boolean yes ) { pd_inputMatchedId = yes; } inline CORBA::ULong inputMessageSize() const { return pd_inputMessageSize; } inline void inputMessageSize(CORBA::ULong msgsz) { pd_inputMessageSize = msgsz; } inline CORBA::ULong inputFragmentToCome() const { return pd_inputFragmentToCome; } inline void inputFragmentToCome(CORBA::ULong fsz) { pd_inputFragmentToCome = fsz; } giopStream_Buffer* inputMessage(); // Read the next GIOP message from the connection. This function does the // basic sanity check on the message header. // // The function honours the deadline set on the the object. If the deadline // is reached, the function should give up waiting. // // Error conditions. If the data do not look like a GIOP message or // the connection reports an error in reading data or the deadline has // expired, this call raises the CommFailure exception. The strand // will be marked as DYING. // // The size of the GIOP message is reported in <size>. // The returned buffer may or may not contain the complete message, i.e. // <last> - <start> may or may not equal to <size>. If it is the latter, // the caller should use inputChunk() to get the rest of the message. // // Thread Safety preconditions: // Caller must have acquired the read lock on the strand. giopStream_Buffer* inputChunk(CORBA::ULong maxsize); // Same as inputMessage except that no sanity check is done on the // data received. The buffer returned contains up to maxsize bytes of // data. The <size> field is not applicable and is set to 0. // // Thread Safety preconditions: // Caller must have acquired the read lock on the strand. void inputCopyChunk(void* dest,CORBA::ULong size); // Same as inputChunk except that data is copied directly into the // destination buffer. // // Thread Safety preconditions: // Caller must have acquired the read lock on the strand. void releaseInputBuffer(giopStream_Buffer*); // Return the buffer given out by inputMessage and inputChunk. // // Thread Safety preconditions: // None. void errorOnReceive(int,const char*,CORBA::ULong,giopStream_Buffer*, CORBA::Boolean); // internal helper function, do not use outside this class CORBA::ULong ensureSaneHeader(const char*,CORBA::ULong, giopStream_Buffer*,CORBA::ULong); // internal helper function, do not use outside this class //////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////// // Sending GIOP messages: // The following variables must be initialised to 0 at ctor. giopStream_Buffer* pd_currentOutputBuffer; // The following variables can be left uninitialised and will be // written with a sensible value when used. CORBA::ULong pd_outputFragmentSize; CORBA::ULong pd_outputMessageSize; CORBA::ULong pd_request_id; inline CORBA::ULong outputMessageSize() const { return pd_outputMessageSize; } inline void outputMessageSize(CORBA::ULong msgsz) { pd_outputMessageSize = msgsz; } inline CORBA::ULong outputFragmentSize() const { return pd_outputFragmentSize; } inline void outputFragmentSize(CORBA::ULong fsz) { pd_outputFragmentSize = fsz; } // GIOP message are sent via these member functions void sendChunk(giopStream_Buffer*); // Send the buffer to the strand. // // The function honours the deadline set on the the object. If the deadline // is reached, the function should give up waiting. // // Thread Safety preconditions: // Caller must have acquired the write lock on the strand. void sendCopyChunk(void*,CORBA::ULong size); // Same as sendChunk() except that the data is copied directly from // the application buffer. // // Thread Safety preconditions: // Caller must have acquired the write lock on the strand. void errorOnSend(int,const char*,CORBA::ULong,CORBA::Boolean); // internal helper function, do not use outside this classprotected: ////////////////////////////////////////////////////////////////// inline CORBA::ULong requestId() const { return pd_request_id; } inline void requestId(CORBA::ULong v) { pd_request_id = v; }};OMNI_NAMESPACE_END(omni)#undef _core_attr#endif // __GIOPSTREAM_H__
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -