]> Creatis software - cpPlugins.git/blob - lib/cpPlugins/Port.h
...
[cpPlugins.git] / lib / cpPlugins / Port.h
1 #ifndef __CPPLUGINS__PORT__H__
2 #define __CPPLUGINS__PORT__H__
3
4 #include <cpPlugins/DataObject.h>
5
6 namespace cpPlugins
7 {
8   /**
9    */
10   class cpPlugins_EXPORT Port
11   {
12   public:
13     typedef Port Self;
14
15   public:
16     Port( );
17     virtual ~Port( );
18     Self& operator=( DataObject* obj );
19     Self& operator=( const Self& other );
20
21     bool IsValid( ) const;
22
23     // This could be seen as a pointer to DataObject's
24     inline DataObject* GetPointer( )
25       { return( this->m_Data.GetPointer( ) ); }
26     inline const DataObject* GetPointer( ) const
27       { return( this->m_Data.GetPointer( ) ); }
28     inline DataObject* operator->( ) const
29       { return( this->m_Data.GetPointer( ) ); }
30
31     inline void SetPointer( DataObject* ptr )
32       { this->m_Data = ptr; }
33
34   protected:
35     cpPlugins::DataObject::Pointer m_Data;
36   };
37
38   /**
39    */
40   class cpPlugins_EXPORT InputPort
41     : public Port
42   {
43   public:
44     typedef InputPort Self;
45     typedef Port      Superclass;
46
47   public:
48     InputPort( bool required = false );
49     virtual ~InputPort( );
50     Self& operator=( DataObject* obj );
51     Self& operator=( const Superclass& other );
52
53     bool IsRequired( ) const;
54     void RequiredOn( );
55     void RequiredOff( );
56     void SetRequired( bool required );
57
58   protected:
59     bool m_Required;
60   };
61
62   /**
63    */
64   class cpPlugins_EXPORT OutputPort
65     : public Port
66   {
67   public:
68     typedef OutputPort Self;
69     typedef Port       Superclass;
70
71   public:
72     OutputPort( );
73     virtual ~OutputPort( );
74     Self& operator=( DataObject* obj );
75     Self& operator=( const Superclass& other );
76   };
77
78 } // ecapseman
79
80 #endif // __CPPLUGINS__PORT__H__
81
82 // eof - $RCSfile$