⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 giopstream.h

📁 编译工具
💻 H
📖 第 1 页 / 共 2 页
字号:
// -*- Mode: C++; -*-//                            Package   : omniORB// giopStream.h                   Created on: 05/01/2001//                            Author    : Sai Lai Lo (sll)////    Copyright (C) 2001 AT&T Laboratories Cambridge////    This file is part of the omniORB library////    The omniORB library is free software; you can redistribute it and/or//    modify it under the terms of the GNU Library General Public//    License as published by the Free Software Foundation; either//    version 2 of the License, or (at your option) any later version.////    This library is distributed in the hope that it will be useful,//    but WITHOUT ANY WARRANTY; without even the implied warranty of//    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU//    Library General Public License for more details.////    You should have received a copy of the GNU Library General Public//    License along with this library; if not, write to the Free//    Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA//    02111-1307, USA////// Description://	*** PROPRIETORY INTERFACE ***///*  $Log: giopStream.h,v $  Revision 1.1.4.8  2005/10/13 11:38:16  dgrisby  Dump CloseConnection messages.  Revision 1.1.4.7  2001/10/17 16:44:05  dpg1  Update DynAny to CORBA 2.5 spec, const Any exception extraction.  Revision 1.1.4.6  2001/09/04 14:38:09  sll  Added the boolean argument to notifyCommFailure to indicate if  omniTransportLock is held by the caller.  Revision 1.1.4.5  2001/09/03 16:50:43  sll  Added the deadline parameter and access functions. All member functions  that previously had deadline arguments now use the per-object deadline  implicitly.  Revision 1.1.4.4  2001/08/03 17:43:19  sll  Make sure dll import spec for win32 is properly done.  Revision 1.1.4.3  2001/07/31 16:20:30  sll  New primitives to acquire read lock on a connection.  Revision 1.1.4.2  2001/05/01 16:07:32  sll  All GIOP implementations should now work with fragmentation and abitrary  sizes non-copy transfer.  Revision 1.1.4.1  2001/04/18 17:18:59  sll  Big checkin with the brand new internal APIs.  Revision 1.1.2.1  2001/02/23 16:47:04  sll  Added new files.  */#ifndef __GIOPSTREAM_H__#define __GIOPSTREAM_H__#ifdef _core_attr# error "A local CPP macro _core_attr has already been defined."#endif#if defined(_OMNIORB_LIBRARY)#     define _core_attr#else#     define _core_attr _OMNIORB_NTDLL_IMPORT#endifOMNI_NAMESPACE_BEGIN(omni)class giopStrand;class giopStreamImpl;class giopImpl10;class giopImpl11;class giopImpl12;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.  giopStream_Buffer*       next;    // next Buffer in a chain  // buffer data to follows.  void alignStart(omni::alignment_t);  static void deleteBuffer(giopStream_Buffer*);  static giopStream_Buffer* newBuffer(CORBA::ULong sz=0);};class giopStream : public cdrStream {public:  giopStream(giopStrand*);  // No thread safety precondition  ~giopStream();  // No thread safety precondition  virtual void* ptrToClass(int* cptr);  static inline giopStream* downcast(cdrStream* s) {    return (giopStream*)s->ptrToClass(&_classid);  }  static _core_attr int _classid;  void reset();  GIOP::Version version();  // No thread safety precondition  operator giopStrand& () { return *pd_strand; }  // No thread safety precondition  giopStreamImpl* impl() const { return pd_impl; }  // No thread safety precondition  void impl(giopStreamImpl* impl) { pd_impl = impl; }  // No thread safety precondition  inline void getDeadline(unsigned long& secs, unsigned long& nanosecs) const {    secs = pd_deadline_secs;    nanosecs = pd_deadline_nanosecs;  }  // No thread safety precondition  inline void setDeadline(unsigned long secs, unsigned long nanosecs) {    pd_deadline_secs = secs;    pd_deadline_nanosecs = nanosecs;  }  // No thread safety precondition    ////////////////////////////////////////////////////////////////////////  ////////////////////////////////////////////////////////////////////////  // Thread Safety preconditions:  //   Caller of these strand locking functions must hold the  //   omniTransportLock before calling.  virtual void rdLock();  // Acquire read lock on the strand.  //  // 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 deadline has expired, this call raises the  // CommFailure exception.  virtual void wrLock();  // Acquire write lock on the strand.  //  // 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 deadline has expired, this call raises the  // CommFailure exception.  virtual void rdUnLock();// Release the read lock if this instance holds one  virtual void wrUnLock();// Release the write lock if this instance holds one.  virtual _CORBA_Boolean rdLockNonBlocking();  // Acquire read lock but do not block if another thread is already  // holding one. Return True if read lock is acquired.  virtual void sleepOnRdLock();  // Block until the read lock is available.  //  // 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 deadline has expired, this call raises the  // CommFailure exception.  virtual void sleepOnRdLockAlways();  // Irrespective of the state of the read lock. Block the thread  // on the read lock condition variable until it is signalled by another  // thread or the deadline in real time has expired.  //  // 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 deadline has expired, this call raises the  // CommFailure exception.  static void wakeUpRdLock(giopStrand*);  // Wakeup all those threads blocking to acquire a read lock.  static _CORBA_Boolean noLockWaiting(giopStrand*);  // Returns True (1) if no thread is waiting to acquire a read or write lock  static _CORBA_Boolean rdLockNonBlocking(giopStrand*);  // Acquire read lock but do not block if another thread is already  // holding one. Return True if read lock is acquired. A variant of  // the member func with the same name except that the caller do not  // have a giopStream at hand.  static void sleepOnRdLock(giopStrand*);  // Block until the read lock is available. A variant of  // the member func with the same name except that the caller do not  // have a giopStream at hand.  void markRdLock();  // Caller must have called rdLockNonBlocking(giopStrand*) and succeeded.  // Mark this instance as the one that have acquired the lock.  static _CORBA_Boolean RdLockIsHeld(giopStrand*);  // Return True (1) if the read lock is held by some giopStream.  ////////////////////////////////////////////////////////////////////////  virtual void notifyCommFailure(CORBA::Boolean heldlock,				 CORBA::ULong& minor,				 CORBA::Boolean& retry);  // When the giopStream detects an error in sending or receiving data,  // it raises the giopStream::CommFailure exception.  // But before it does so, it calls this function to determine the   // the minor code of the exception. The function set the value.  // Notice that this is a virtual function. The intention is for the  // derived classes GIOP_S and GIOP_C to override this function in order  // to intercept the callback. The override function can then look at its  // internal state, e.g. the progress of a call, to decide what the  // minor code should be.  //  // The function also set retry to TRUE(1) if the invocation should be  // relaunched.  //  // Unless this function is overridden, the function returns minor = 0  // retry = 0.  //  // Thread Safety preconditions:  //    Internally, omniTransportLock is used for synchronisation, if  //    <heldlock> is TRUE(1), the caller already hold the lock.  ////////////////////////////////////////////////////////////////////////  ////////////////////////////////////////////////////////////////////////  // CommFailure is the exception raised by giopStream when it details an  // error in sending or receiving data in any of member functions derived  // from cdrStream. (see below)  class CommFailure {  public:    inline CommFailure(CORBA::ULong minor,		       CORBA::CompletionStatus status,		       CORBA::Boolean retry,		       const char* filename,		       CORBA::ULong linenumber) :      pd_minor(minor), pd_status(status), pd_retry(retry),      pd_filename(filename),pd_linenumber(linenumber) {}    // minor - error no.    // status - completion status    // retry - TRUE(1) the invocation SHOULD BE relaunched    //         FALSE(0) don't bother    // filename - source file    // linenumber - line number where the exception is raised.    inline ~CommFailure() {}    inline CORBA::ULong minor() const { return pd_minor; }    inline CORBA::CompletionStatus completed() const { return pd_status; }    inline CORBA::Boolean retry() const { return pd_retry; }    inline const char* filename() const { return pd_filename; }    inline CORBA::ULong linenumber() const { return pd_linenumber; }    inline CommFailure(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) {}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -