Open Inventor Release 2023.2.3
 
Loading...
Searching...
No Matches
SoImageVizEngineOutput.h
Go to the documentation of this file.
1/*=======================================================================
2 *** THE CONTENT OF THIS WORK IS PROPRIETARY TO FEI S.A.S, (FEI S.A.S.), ***
3 *** AND IS DISTRIBUTED UNDER A LICENSE AGREEMENT. ***
4 *** ***
5 *** REPRODUCTION, DISCLOSURE, OR USE, IN WHOLE OR IN PART, OTHER THAN AS ***
6 *** SPECIFIED IN THE LICENSE ARE NOT TO BE UNDERTAKEN EXCEPT WITH PRIOR ***
7 *** WRITTEN AUTHORIZATION OF FEI S.A.S. ***
8 *** ***
9 *** RESTRICTED RIGHTS LEGEND ***
10 *** USE, DUPLICATION, OR DISCLOSURE BY THE GOVERNMENT OF THE CONTENT OF THIS ***
11 *** WORK OR RELATED DOCUMENTATION IS SUBJECT TO RESTRICTIONS AS SET FORTH IN ***
12 *** SUBPARAGRAPH (C)(1) OF THE COMMERCIAL COMPUTER SOFTWARE RESTRICTED RIGHT ***
13 *** CLAUSE AT FAR 52.227-19 OR SUBPARAGRAPH (C)(1)(II) OF THE RIGHTS IN ***
14 *** TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 52.227-7013. ***
15 *** ***
16 *** COPYRIGHT (C) 1996-2023 BY FEI S.A.S, ***
17 *** BORDEAUX, FRANCE ***
18 *** ALL RIGHTS RESERVED ***
19**=======================================================================*/
20/*=======================================================================
21** Author : David Beilloin (Sep 2013)
22**=======================================================================*/
23#ifndef _SO_IMAGE_PROCESSING_OUTPUT_H_
24#define _SO_IMAGE_PROCESSING_OUTPUT_H_
25
26#include <ImageViz/SoImageViz.h>
27
30
33
34
35#ifndef HIDDEN_FROM_DOC
36
40template<class OutputFieldType, class OutputType>class SoDEPRECATED ImageVizEngineOutputHelper
42{
43public:
44 static OutputType getValue(const OutputFieldType *field)
45 {
46 return static_cast<OutputType> ( field->getValue() );
47 }
48};
49
50#endif// HIDDEN_FROM_DOC
51
52
69template <typename OutputFieldType, typename OutputType>class SoDEPRECATED SoImageVizEngineOutput : public SoEngineOutput
71{
72public:
73
77
80 {}
81
83 OutputType getValue() const
84 {
85 assert(getContainer()!=NULL);
86 getContainer()->evaluateWrapper();
87 return ImageVizEngineOutputHelper<OutputFieldType, OutputType>::getValue(&m_data);
88 }
89
95 void setValue(OutputType value)
96 {
97 m_data.setValue( value );
98 }
99
100SoINTERNAL private:
102 virtual bool updateConnection()
103 {
104 if (isEnabled())
105 {
106 SoFieldList connectedFieldList;
107 int numConnectedField = getForwardConnections(connectedFieldList);
108 for (int connectionIdx=0;connectionIdx<numConnectedField;++connectionIdx)
109 {
110 OutputFieldType* connectedField = dynamic_cast<OutputFieldType*>(connectedFieldList[connectionIdx]);
111 if ( connectedField )
112 {
113 if ( !connectedField->isReadOnly() )
114 connectedField->copyFrom(m_data);
115 }
116#if defined(_DEBUG)
117 else
118 SoDebugError::post(OIV_FUNCTION,"Invalid connection Field Type.");
119#endif // _DEBUG
120 }
121 }
122 return true;
123 }
124
125private:
126 // Store the cached output
127 OutputFieldType m_data;
128
129 friend class SoImageVizEngineOutputPrivateAccessor;
130};
131
141template <typename OutputFieldType, typename OutputType>class SoDEPRECATED SoImageVizEngineMFieldOutput : public SoEngineOutput
143{
144public:
145
149
153
155 OutputType getValue() const
156 {
157 assert( getContainer() != NULL );
158 getContainer()->evaluateWrapper();
159 return static_cast< OutputType>( m_data.getValues( 0 ) );
160 }
161
163 size_t getSize() const
164 {
165 assert( getContainer() != NULL );
166 getContainer()->evaluateWrapper();
167 return m_data.getNum();
168 }
169
175 void setValue( OutputType value, int size )
176 {
177 m_data.deleteValues( 0 );
178 m_data.setValues( 0, size, value );
179 }
180
181
182SoINTERNAL private:
184 virtual bool updateConnection()
185 {
186 if ( isEnabled() )
187 {
188 SoFieldList connectedFieldList;
189 int numConnectedField = getForwardConnections( connectedFieldList );
190 for ( int connectionIdx = 0; connectionIdx < numConnectedField; ++connectionIdx )
191 {
192 OutputFieldType* connectedField = dynamic_cast<OutputFieldType*>( connectedFieldList[connectionIdx] );
193 if ( connectedField )
194 {
195 if ( !connectedField->isReadOnly() )
196 connectedField->copyFrom( m_data );
197 }
198#if defined(_DEBUG)
199 else
200 SoDebugError::post( __FUNCTION__, "Invalid connection Field Type." );
201#endif // _DEBUG
202 }
203 }
204 return true;
205 }
206
207private:
208 // Store the cached output
209 OutputFieldType m_data;
210
211 friend class SoImageVizEngineMFieldOutputPrivateAccessor;
212};
213
214
215#endif
#define SoINTERNAL
valueRef getValue() const
Definition SoSubField.h:234
static void post(const char *methodName, const char *formatString ...)
Posts an error.
Class for all engine outputs.
Definition SoEngine.h:282
Maintains a list of pointers to fields.
Definition SoFieldList.h:72
<a href="IconLegend.html"><img src="extIP.gif" alt="ImageViz" border="0"></a> Image Processing outpu...
virtual ~SoImageVizEngineMFieldOutput()
Destructor.
void setValue(OutputType value, int size)
Set the cached output value.
OutputType getValue() const
Return the cached output value.
size_t getSize() const
Return the cached output value.
<a href="IconLegend.html"><img src="extIP.gif" alt="ImageViz" border="0"></a> Image Processing outpu...
virtual ~SoImageVizEngineOutput()
Destructor.
OutputType getValue() const
Return the cached output value.
void setValue(OutputType value)
Set the cached output value.
size_t size() const
#define OIV_FUNCTION
Definition port.h:34