home *** CD-ROM | disk | FTP | other *** search
/ Power GUI Programming with VisualAge C++ / powergui.iso / trialva / ibmcppw / include / ivbconn.hpp < prev    next >
Encoding:
C/C++ Source or Header  |  1996-02-22  |  15.4 KB  |  396 lines

  1. #ifndef _IVBCONN_
  2.   #define _IVBCONN_
  3. /*******************************************************************************
  4. * FILE NAME: ivbconn.hpp                                                       *
  5. *                                                                              *
  6. * DESCRIPTION:                                                                 *
  7. *   Declaration of the class(es):                                              *
  8. *    IVBConnection - VB variable class base.                                   *
  9. *                                                                              *
  10. * COPYRIGHT:                                                                   *
  11. *   IBM(R) VisualAge(TM) for C++                                               *
  12. *   (C) Copyright International Business Machines Corporation 1991, 1996       *
  13. *   Licensed Material - Program-Property of IBM - All Rights Reserved.         *
  14. *   US Government Users Restricted Rights - Use, duplication, or disclosure    *
  15. *   restricted by GSA ADP Schedule Contract with IBM Corp.                     *
  16. *                                                                              *
  17. *   This program will not run in DOS mode.                                     *
  18. *                                                                              *
  19. *******************************************************************************/
  20. #ifndef _IVBDEFS__
  21. #include <ivbdefs.h>
  22. #endif
  23.  
  24. #ifndef _IOBSERVR_
  25.   #include <iobservr.hpp>
  26. #endif
  27.  
  28. #ifndef _ISTDNTFY_
  29.   #include <istdntfy.hpp>
  30. #endif
  31.  
  32. /*-------------------------- Pragma Library Support --------------------------*/
  33. #ifndef __NO_DEFAULT_LIBS__
  34.   #ifdef __OS2__
  35.     #ifdef __IMPORTLIB__
  36.        #pragma library("CPPOOV3I.LIB")
  37.     #else
  38.        #pragma library("CPPOOV3.LIB")
  39.     #endif
  40.   #endif
  41.   #ifdef __WINDOWS__
  42.     #ifdef __IMPORTLIB__
  43.        #pragma library("CPPWOV3I.LIB")
  44.     #else
  45.        #pragma library("CPPWOV3.LIB")
  46.     #endif
  47.   #endif
  48. #endif
  49.  
  50. /*----------------------------------------------------------------------------*/
  51. /* Align classes on four byte boundary.                                       */
  52. /*----------------------------------------------------------------------------*/
  53. #pragma pack(4)
  54.  
  55. class IVBConnection : public IObserver {
  56. public:
  57. /*--------------------------- PUBLIC -----------------------------------------*/
  58.  
  59. /*------------------------ Constructors ----------------------------------------
  60. | You can construct an instance of this class in the following ways:           |
  61. ------------------------------------------------------------------------------*/
  62.   IVBConnection ();
  63. virtual
  64.   ~IVBConnection ();
  65.  
  66. /*---------------------------- Enumerations ----------------------------------*/
  67. enum Process {
  68.   terminated = -3,
  69.   uninitialize = -2,
  70.   disabled = -1,
  71.   normal = 0,
  72.   skip = 0,
  73.   sourceChanged,
  74.   targetChanged
  75. };
  76.  
  77. virtual IString
  78.   asString() const,
  79.   asDebugInfo () const;
  80.  
  81. /*---------------------------- Member Functions --------------------------------
  82. | These operations can be used to query and change the attributes:             |
  83. |                                                                              |
  84. |   initialize         - Initialize the connection.                            |
  85. |   perform            - Perform the connection.                               |
  86. |   terminate          - Terminate the connection.                             |
  87. ------------------------------------------------------------------------------*/
  88. virtual void
  89.   initialize               (),
  90.   perform                  (const INotificationEvent& anEvent),
  91.   terminate                ();
  92.  
  93. virtual int
  94.   checkEvent               (const INotificationEvent& event) const;
  95. virtual int
  96.   handleException          (const INotificationEvent& event, const IException& exc);
  97.  
  98. /*-------------------------------- Events --------------------------------------
  99. | These are notification events provided:                                      |
  100. |   exceptionId       - exception occurred id.                                 |
  101. |   actionResultId    - action result changed id.                              |
  102. ------------------------------------------------------------------------------*/
  103. static INotificationId const
  104.   IVB_IMPORT exceptionId,
  105.   IVB_IMPORT actionResultId;
  106.  
  107. static Boolean
  108.   isApplicationConnectionTrace(),
  109.   isApplicationExceptionBeep(),
  110.   isApplicationExceptionMessageBox();
  111.   isApplicationExceptionTrace();
  112.  
  113. static void
  114.   enableApplicationConnectionTrace(Boolean connectionTrace = true),
  115.   enableApplicationExceptionBeep(Boolean exceptionTrace = true),
  116.   enableApplicationExceptionMessageBox(Boolean exceptionTrace = true),
  117.   enableApplicationExceptionTrace(Boolean exceptionTrace = true);
  118.  
  119. protected:
  120. virtual IObserver
  121.  &dispatchNotificationEvent(const INotificationEvent& event);
  122.  
  123.   Process iStatus;
  124. static int flags;
  125. };
  126.  
  127. class IVBConnectionPart : public IVBConnection, public IStandardNotifier {
  128. public:
  129. /*--------------------------- PUBLIC -----------------------------------------*/
  130.  
  131. /*------------------------ Constructors ----------------------------------------
  132. | You can construct an instance of this class in the following ways:           |
  133. ------------------------------------------------------------------------------*/
  134.   IVBConnectionPart ();
  135. virtual
  136.   ~IVBConnectionPart ();
  137.  
  138. /*-------------------------------- Attributes ----------------------------------
  139. | These operations can be used to query and change the attributes:             |
  140. |                                                                              |
  141. |   initialize         - Initialize the connection.                            |
  142. ------------------------------------------------------------------------------*/
  143. virtual void
  144.   initialize               ();
  145.  
  146. virtual int
  147.   handleException          (const INotificationEvent& event, const IException& exc);
  148. };
  149.  
  150. class IVBActionConnection : public IVBConnection {
  151. public:
  152. /*--------------------------- PUBLIC -----------------------------------------*/
  153.  
  154. /*------------------------ Constructors ----------------------------------------
  155. | You can construct an instance of this class in the following ways:           |
  156. ------------------------------------------------------------------------------*/
  157.   IVBActionConnection (INotifier* aSource);
  158. virtual
  159.   ~IVBActionConnection ();
  160.  
  161. /*-------------------------------- Attributes ----------------------------------
  162. | These operations can be used to query and change the attributes:             |
  163. |                                                                              |
  164. |   terminate          - Terminate the connection.                             |
  165. ------------------------------------------------------------------------------*/
  166. virtual void
  167.   terminate                ();
  168.  
  169. protected:
  170.   INotifier* source;
  171. };
  172.  
  173. class IVBActionConnectionPart : public IVBActionConnection, public IStandardNotifier {
  174. public:
  175. /*--------------------------- PUBLIC -----------------------------------------*/
  176.  
  177. /*------------------------ Constructors ----------------------------------------
  178. | You can construct an instance of this class in the following ways:           |
  179. ------------------------------------------------------------------------------*/
  180.   IVBActionConnectionPart (INotifier* aSource);
  181. virtual
  182.   ~IVBActionConnectionPart ();
  183.  
  184. /*-------------------------------- Actions    ----------------------------------
  185. | These operations can be used to query and change the attributes:             |
  186. |                                                                              |
  187. |   initialize         - Initialize the connection.                            |
  188. ------------------------------------------------------------------------------*/
  189. virtual void
  190.   initialize               ();
  191. void
  192.   notifyActionResult       ();
  193.  
  194. virtual int
  195.   handleException          (const INotificationEvent& event, const IException& exc);
  196. };
  197.  
  198. class IVBCustomLogicConnection : public IVBConnection {
  199. public:
  200. /*--------------------------- PUBLIC -----------------------------------------*/
  201.  
  202. /*------------------------ Constructors ----------------------------------------
  203. | You can construct an instance of this class in the following ways:           |
  204. ------------------------------------------------------------------------------*/
  205.   IVBCustomLogicConnection ();
  206. virtual
  207.   ~IVBCustomLogicConnection ();
  208. };
  209.  
  210. class IVBCustomLogicConnectionPart : public IVBCustomLogicConnection, public IStandardNotifier {
  211. public:
  212. /*--------------------------- PUBLIC -----------------------------------------*/
  213.  
  214. /*------------------------ Constructors ----------------------------------------
  215. | You can construct an instance of this class in the following ways:           |
  216. ------------------------------------------------------------------------------*/
  217.   IVBCustomLogicConnectionPart ();
  218. virtual
  219.   ~IVBCustomLogicConnectionPart ();
  220.  
  221. /*-------------------------------- Attributes ----------------------------------
  222. | These operations can be used to query and change the attributes:             |
  223. |                                                                              |
  224. |   initialize         - Initialize the connection.                            |
  225. ------------------------------------------------------------------------------*/
  226. virtual void
  227.   initialize               ();
  228.  
  229. virtual int
  230.   handleException          (const INotificationEvent& event, const IException& exc);
  231. };
  232.  
  233. class IVBAttributeConnection : public IVBConnection {
  234. public:
  235. /*--------------------------- PUBLIC -----------------------------------------*/
  236.  
  237. /*------------------------ Constructors ----------------------------------------
  238. | You can construct an instance of this class in the following ways:           |
  239. ------------------------------------------------------------------------------*/
  240.   IVBAttributeConnection ();
  241. virtual
  242.   ~IVBAttributeConnection ();
  243.  
  244. /*--------------------------- Member Functions ---------------------------------
  245. | These operations can be used to query and change the attributes:             |
  246. |                                                                              |
  247. |   initializeConnection - Initialize the connection.                          |
  248. ------------------------------------------------------------------------------*/
  249. virtual void
  250.   initialize               (),
  251.   setSource                (),
  252.   performSetSource         (),
  253.   setTarget                (),
  254.   performSetTarget         ();
  255.  
  256. virtual int
  257.   handleSourceException    (const IException& exc),
  258.   handleTargetException    (const IException& exc);
  259.  
  260. /*-------------------------------- Events --------------------------------------
  261. | These are notification events provided:                                      |
  262. |   sourceExceptionId - source exception occurred id.                          |
  263. |   targetExceptionId - source exception occurred id.                          |
  264. ------------------------------------------------------------------------------*/
  265. static INotificationId const
  266.   IVB_IMPORT sourceExceptionId,
  267.   IVB_IMPORT targetExceptionId;
  268.  
  269. protected:
  270. virtual IObserver
  271.  &dispatchNotificationEvent(const INotificationEvent& event);
  272. };
  273.  
  274. class IVBAttributeConnectionPart : public IVBAttributeConnection,
  275.                                    public IStandardNotifier {
  276. public:
  277. /*--------------------------- PUBLIC -----------------------------------------*/
  278.  
  279. /*------------------------ Constructors ----------------------------------------
  280. | You can construct an instance of this class in the following ways:           |
  281. ------------------------------------------------------------------------------*/
  282.   IVBAttributeConnectionPart ();
  283. virtual
  284.   ~IVBAttributeConnectionPart ();
  285.  
  286. /*-------------------------------- Attributes ----------------------------------
  287. | These operations can be used to query and change the attributes:             |
  288. |                                                                              |
  289. |   initialize         - Initialize the connection.                            |
  290. |   terminate          - Terminate the connection.                             |
  291. ------------------------------------------------------------------------------*/
  292. virtual void
  293.   initialize               (),
  294.   terminate                ();
  295.  
  296. virtual int
  297.   handleSourceException    (const IException& exc),
  298.   handleTargetException    (const IException& exc);
  299. };
  300.  
  301.  
  302. class IVBConnectionDataList;
  303. typedef IVBConnection*
  304.   IVBConnectionPtr;
  305.  
  306. class _Export IVBConnectionList : public IVBase {
  307. public:
  308.  
  309. /*---------------------------- Constructors ----------------------------------*/
  310.   IVBConnectionList     ( );
  311. virtual
  312.  ~IVBConnectionList     ( );
  313.  
  314. class _Export Cursor : public IVBase {
  315. public:
  316. /*---------------------------- Constructors ----------------------------------*/
  317.   Cursor ( IVBConnectionList& connectionList );
  318. virtual
  319.  ~Cursor ( );
  320.  
  321. /*-------------------------- Cursor Movement ---------------------------------*/
  322. virtual Boolean
  323.   setToFirst      ( ),
  324.   setToNext       ( ),
  325.   setToLast       ( ),
  326.   setToPrevious   ( ),
  327.   isValid         ( ) const;
  328.  
  329. virtual void
  330.   invalidate      ( );
  331.  
  332. private:
  333. /*--------------------------------- Private ----------------------------------*/
  334. friend class IVBConnectionList;
  335. void
  336.  *fCursor;
  337. }; //Cursor
  338.  
  339. friend class IVBConnectionList::Cursor;
  340.  
  341. /*---------------------- connection Addition and Removal -----------------------*/
  342. virtual IVBConnection
  343.  &elementAt       (const Cursor& cursor) const;
  344.  
  345. virtual IVBConnectionList
  346.  &add             (IVBConnection& connection),
  347.  &add             (IVBConnection* connection),
  348.  &removeAt        (const Cursor& cursor),
  349.  &remove          (const IVBConnection& connection),
  350.  &removeAll       ();
  351.  
  352. Boolean
  353.   isEmpty          () const;
  354. unsigned long
  355.   numberOfElements () const;
  356.  
  357. virtual IVBConnectionList
  358.  &initialize       (),
  359.  &terminate        ();
  360.  
  361. private:
  362. /*--------------------------------- Private ----------------------------------*/
  363. IVBConnectionDataList
  364.   *fConnectionDataList;
  365. /*----------------------------- Hidden Functions -----------------------------*/
  366. IVBConnectionList ( const IVBConnectionList& connectionList );
  367. IVBConnectionList
  368.  &operator= (const IVBConnectionList& connectionList);
  369.  
  370. }; //IVBConnectionList
  371.  
  372. class IVBFactoryPart : public IStandardNotifier {
  373. public:
  374. /*--------------------------- PUBLIC -----------------------------------------*/
  375.  
  376. /*------------------------ Constructors ----------------------------------------
  377. | You can construct an instance of this class in the following ways:           |
  378. ------------------------------------------------------------------------------*/
  379.   IVBFactoryPart ();
  380. virtual
  381.   ~IVBFactoryPart ();
  382. /*-------------------------------- Events --------------------------------------
  383. | These are notification events provided:                                      |
  384. |     newObjectCreatedId  - new object created id.                             |
  385. ------------------------------------------------------------------------------*/
  386. static INotificationId const
  387.   IVB_IMPORT newObjectCreatedId;
  388. };
  389.  
  390. /*----------------------------------------------------------------------------*/
  391. /* Resume compiler default packing.                                           */
  392. /*----------------------------------------------------------------------------*/
  393. #pragma pack()
  394.  
  395. #endif /* _IVBCONN_ */
  396.