DataDirector API
DDD_ConvertBase.h
Go to the documentation of this file.
1 #ifndef _DDD_ConvertBase_h_
2 #define _DDD_ConvertBase_h_
3 
4 /*! \file DDD_ConvertBase.h
5  \brief The DDD_ConvertBase class. Base class for Data Director converters.
6 
7  \par Copyright Information
8 
9  Copyright (c) 2012 The DiSTI Corporation.<br>
10  11301 Corporate Blvd; Suite 100<br>
11  Orlando, Florida 32817<br>
12  USA<br>
13  <br>
14  All rights reserved.<br>
15 
16  This Software contains proprietary trade secrets of DiSTI and may not be
17 reproduced, in whole or part, in any form, or by any means of electronic,
18 mechanical, or otherwise, without the written permission of DiSTI. Said
19 permission may be derived through the purchase of applicable DiSTI product
20 licenses which detail the distribution rights of this content and any
21 Derivative Works based on this or other copyrighted DiSTI Software.
22 
23  NO WARRANTY. THE SOFTWARE IS PROVIDED "AS-IS," WITHOUT WARRANTY OF ANY KIND,
24 AND ANY USE OF THIS SOFTWARE PRODUCT IS AT YOUR OWN RISK. TO THE MAXIMUM EXTENT
25 PERMITTED BY APPLICABLE LAW, DISTI AND ITS SUPPLIERS DISCLAIM ALL WARRANTIES
26 AND CONDITIONS, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
27 IMPLIED WARRANTIES AND CONDITIONS OF MERCHANTABILITY AND/OR FITNESS FOR A
28 PARTICULAR PURPOSE, TITLE, AND NON-INFRINGEMENT, WITH REGARD TO THE SOFTWARE.
29 
30  LIMITATION OF LIABILITY. TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW,
31 IN NO EVENT SHALL DISTI OR ITS SUPPLIERS BE LIABLE FOR ANY SPECIAL, INCIDENTAL,
32 INDIRECT, OR CONSEQUENTIAL DAMAGES WHATSOEVER (INCLUDING, WITHOUT LIMITATION,
33 DAMAGES FOR LOSS OF BUSINESS PROFITS, BUSINESS INTERRUPTION, LOSS OF BUSINESS
34 INFORMATION, OR ANY OTHER PECUNIARY LOSS) ARISING OUT OF THE USE OF OR
35 INABILITY TO USE THE SOFTWARE, EVEN IF DISTI HAS BEEN ADVISED OF THE POSSIBLITY
36 OF SUCH DAMAGES. DISTI'S ENTIRE LIABILITY AND YOUR EXCLUSIVE REMEDY SHALL NOT
37 EXCEED FIVE DOLLARS (US$5.00).
38 
39  The aforementioned terms and restrictions are governed by the laws of the
40 State of Florida and the United States of America.
41 
42 */
43 
44 #include "DDD_ConnectionEndpoint.h"
45 #include "DDD_AssetBase.h"
46 #include <string>
47 
48 
49 /** \def Create_ConverterFactory(ConvertName, ConvertType) use this to allow the converter factory to find the create function
50  *
51  * Example:
52  * Create_ConverterFactory(Assign, DDD_ConvertAssign);
53  * create a function called Create_ConvertAssign that returns an instance of
54  * DDD_ConvertAssign as a DDD_ConvertBase *
55 */
56 #define Create_ConverterFactory(ConvertName, ConvertType) DDD_EXPORT_EXTERN_C DDD_ConvertBase *Create_Convert##ConvertName(DDD_AttributeObserver* observer) \
57 { \
58  return new ConvertType(observer); \
59 }
60 
61 namespace disti
62 {
63 
64 #define MAX_CONVERTER_INPUT 65535 /**< Maximum number of inputs (limited for performance) */
65 #define MAX_CONVERTER_OUTPUT 65535 /**< Maximum number of outputs (limited for performance) */
66 
67 /** \brief Abstract base class for all DDD_DataDirector converters */
68 class DDD_EXPORT DDD_ConvertBase : public DDD_Base, public DDD_AttributeContainer
69 {
70 public:
71  /** Constructor */
73 
74  /* Destructor */
75  virtual ~DDD_ConvertBase();
76 
77  /** \return Returns string identifying which version of DataDirector this converter was built against
78  */
79  const char * DataDirectorVersion();
80 
81  /** Returns a string label for the input index.
82  * Converters must provide named labels to differentiate between different inputs/outputs.
83  * \param index The index of the input
84  */
85  virtual std::string EndpointInputName(int index);
86 
87  /** Returns a string label for the output index.
88  * Converters must provide named labels to differentiate between different inputs/outputs.
89  * \param index The index of the output
90  */
91  virtual std::string EndpointOutputName(int index);
92 
93  /** Initializes the converter, if necessary
94  * \param paramString
95  * \return True if the converter was successfully initialized.
96  */
97  virtual bool Init(const std::string &paramStr);
98 
99  /** \return Returns the minimum number of inputs required by this converter
100  */
101  virtual int MinInputs() { return 1; }
102 
103  /** \return Returns the maximum number of inputs supported by this converter
104  */
105  virtual int MaxInputs() { return 1; }
106 
107  /** \return Returns the minimum number of outputs required by this converter
108  */
109  virtual int MinOutputs() { return 1; }
110 
111  /** \return Returns the maximum number of outputs supported by this converter
112  */
113  virtual int MaxOutputs() { return 1; }
114 
115  /** \return Returns true if the converter's configuration is valid
116  * \param inputs List of converter inputs
117  * \param outputs List of converter outputs
118  */
119  virtual bool ConfigurationValid(DDD_EndpointList& inputs, DDD_EndpointList& outputs);
120 
121  // These must be implemented /////////////////////////////////////////////////////
122 
123  /** Performs the actual conversion function
124  * \param inputs A list of inputs to the converter
125  * \param outputs A list of outputs to the converter
126  * \return True if the converter fired.
127  */
128  virtual bool Convert(DDD_EndpointList& inputs, DDD_EndpointList& outputs) = 0;
129 
130  /** \return Returns the class name of this converter
131  */
132  virtual const char* ClassName() = 0;
133 
134  /** Used by the GUI to explain what this converter does
135  * \return Returns a string for the GUI to use
136  */
137  virtual const char* Description()=0;
138 
139  // From DDD_AttributeContainer
140  virtual const char* GetName() {return GetInstanceName();}
141 
142 protected:
143  /** Checks that nInputs fall within the allowed number of inputs
144  * \param nInputs The number of inputs
145  * \return True if the number of inputs is valid
146  */
147  bool InputsOK(int nInputs);
148 
149  /** Checks that nOutputs fall within the allowed number of outputs
150  * \param nOutputs The number of outputs
151  * \return True if the number of outputs is valid
152  */
153  bool OutputsOK(int nOutputs);
154 };
155 
156 
157 } // end namespace disti
158 
159 #endif
160 
DDD_AttributeContainer. A virtual interface class for containers of attributes.
Definition: DDD_AttributeBase.h:57
The DDD_EndpintList class. A list of DDD_Endpoints.
Definition: DDD_ConnectionEndpoint.h:119
Abstract base class for all DDD_DataDirector converters.
Definition: DDD_ConvertBase.h:68
virtual int MinOutputs()
Definition: DDD_ConvertBase.h:109
The DDD_AssetBase class. Base class for Data Director assets.
The DDD_Base class. Base class for Data Director objects.
Definition: DDD_Base.h:53
virtual int MaxInputs()
Definition: DDD_ConvertBase.h:105
virtual int MaxOutputs()
Definition: DDD_ConvertBase.h:113
virtual int MinInputs()
Definition: DDD_ConvertBase.h:101
Definition: AttributeChangedEmitter.h:46