fixed: compile issue
[opensg.git] / Source / System / Window / Foreground / OSGFileGrabForegroundBase.cpp
blob8878485577fc47da22e37ad08529b391bc5b2b90
1 /*---------------------------------------------------------------------------*\
2 * OpenSG *
3 * *
4 * *
5 * Copyright (C) 2000-2013 by the OpenSG Forum *
6 * *
7 * www.opensg.org *
8 * *
9 * contact: dirk@opensg.org, gerrit.voss@vossg.org, carsten_neumann@gmx.net *
10 * *
11 \*---------------------------------------------------------------------------*/
12 /*---------------------------------------------------------------------------*\
13 * License *
14 * *
15 * This library is free software; you can redistribute it and/or modify it *
16 * under the terms of the GNU Library General Public License as published *
17 * by the Free Software Foundation, version 2. *
18 * *
19 * This library is distributed in the hope that it will be useful, but *
20 * WITHOUT ANY WARRANTY; without even the implied warranty of *
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
22 * Library General Public License for more details. *
23 * *
24 * You should have received a copy of the GNU Library General Public *
25 * License along with this library; if not, write to the Free Software *
26 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. *
27 * *
28 \*---------------------------------------------------------------------------*/
29 /*---------------------------------------------------------------------------*\
30 * Changes *
31 * *
32 * *
33 * *
34 * *
35 * *
36 * *
37 \*---------------------------------------------------------------------------*/
39 /*****************************************************************************\
40 *****************************************************************************
41 ** **
42 ** This file is automatically generated. **
43 ** **
44 ** Any changes made to this file WILL be lost when it is **
45 ** regenerated, which can become necessary at any time. **
46 ** **
47 ** Do not change this file, changes should be done in the derived **
48 ** class FileGrabForeground!
49 ** **
50 *****************************************************************************
51 \*****************************************************************************/
53 #include <cstdlib>
54 #include <cstdio>
56 #ifdef WIN32
57 #pragma warning(disable: 4355) // turn off 'this' : used in base member initializer list warning
58 #pragma warning(disable: 4290) // disable exception specification warning
59 #endif
61 #include "OSGConfig.h"
66 #include "OSGFileGrabForegroundBase.h"
67 #include "OSGFileGrabForeground.h"
69 #include <boost/bind.hpp>
71 OSG_BEGIN_NAMESPACE
73 /***************************************************************************\
74 * Description *
75 \***************************************************************************/
77 /*! \class OSG::FileGrabForeground
78 The FileGrabForeground is used for grabbing a frame or sequence of frames to
79 disk. See \ref
80 PageSystemWindowForegroundGrabFile for a description.
82 The name of the file(s) grabbed to are defined by the _sfName Field, the
83 current frame number by _sfFrame. _sfIncrement can be used to automatically
84 increment the frame number after each image is written. The whole grabber can
85 be activated/deactivated using _sfActive.
88 /***************************************************************************\
89 * Field Documentation *
90 \***************************************************************************/
92 /*! \var std::string FileGrabForegroundBase::_sfName
93 The filename template. %d is replaced by the frame number.
96 /*! \var UInt32 FileGrabForegroundBase::_sfFrame
97 The frame number to use.
100 /*! \var bool FileGrabForegroundBase::_sfIncrement
101 Flag to start/stop automatic frame increments after each grab.
105 /***************************************************************************\
106 * FieldType/FieldTrait Instantiation *
107 \***************************************************************************/
109 #if !defined(OSG_DO_DOC) || defined(OSG_DOC_DEV)
110 PointerType FieldTraits<FileGrabForeground *, nsOSG>::_type(
111 "FileGrabForegroundPtr",
112 "GrabForegroundPtr",
113 FileGrabForeground::getClassType(),
114 nsOSG);
115 #endif
117 OSG_FIELDTRAITS_GETTYPE_NS(FileGrabForeground *, nsOSG)
119 OSG_EXPORT_PTR_SFIELD_FULL(PointerSField,
120 FileGrabForeground *,
121 nsOSG)
123 OSG_EXPORT_PTR_MFIELD_FULL(PointerMField,
124 FileGrabForeground *,
125 nsOSG)
127 /***************************************************************************\
128 * Field Description *
129 \***************************************************************************/
131 void FileGrabForegroundBase::classDescInserter(TypeObject &oType)
133 FieldDescriptionBase *pDesc = NULL;
136 pDesc = new SFString::Description(
137 SFString::getClassType(),
138 "name",
139 "The filename template. %d is replaced by the frame number.\n",
140 NameFieldId, NameFieldMask,
141 false,
142 (Field::SFDefaultFlags | Field::FStdAccess),
143 static_cast<FieldEditMethodSig>(&FileGrabForeground::editHandleName),
144 static_cast<FieldGetMethodSig >(&FileGrabForeground::getHandleName));
146 oType.addInitialDesc(pDesc);
148 pDesc = new SFUInt32::Description(
149 SFUInt32::getClassType(),
150 "frame",
151 "The frame number to use.\n",
152 FrameFieldId, FrameFieldMask,
153 false,
154 (Field::SFDefaultFlags | Field::FStdAccess),
155 static_cast<FieldEditMethodSig>(&FileGrabForeground::editHandleFrame),
156 static_cast<FieldGetMethodSig >(&FileGrabForeground::getHandleFrame));
158 oType.addInitialDesc(pDesc);
160 pDesc = new SFBool::Description(
161 SFBool::getClassType(),
162 "increment",
163 "Flag to start/stop automatic frame increments after each grab.\n",
164 IncrementFieldId, IncrementFieldMask,
165 false,
166 (Field::SFDefaultFlags | Field::FStdAccess),
167 static_cast<FieldEditMethodSig>(&FileGrabForeground::editHandleIncrement),
168 static_cast<FieldGetMethodSig >(&FileGrabForeground::getHandleIncrement));
170 oType.addInitialDesc(pDesc);
174 FileGrabForegroundBase::TypeObject FileGrabForegroundBase::_type(
175 FileGrabForegroundBase::getClassname(),
176 Inherited::getClassname(),
177 "NULL",
178 nsOSG, //Namespace
179 reinterpret_cast<PrototypeCreateF>(&FileGrabForegroundBase::createEmptyLocal),
180 reinterpret_cast<InitContainerF>(&FileGrabForeground::initMethod),
181 reinterpret_cast<ExitContainerF>(&FileGrabForeground::exitMethod),
182 reinterpret_cast<InitalInsertDescFunc>(
183 reinterpret_cast<void *>(&FileGrabForeground::classDescInserter)),
184 false,
186 "<?xml version=\"1.0\"?>\n"
187 "\n"
188 "<FieldContainer\n"
189 " name=\"FileGrabForeground\"\n"
190 " parent=\"GrabForeground\"\n"
191 " library=\"Window\"\n"
192 " pointerfieldtypes=\"both\"\n"
193 " structure=\"concrete\"\n"
194 " systemcomponent=\"true\"\n"
195 " parentsystemcomponent=\"true\"\n"
196 " decoratable=\"false\"\n"
197 " useLocalIncludes=\"false\"\n"
198 " docGroupBase=\"GrpWindowForeground\"\n"
199 " >\n"
200 " The FileGrabForeground is used for grabbing a frame or sequence of frames to\n"
201 " disk. See \\ref\n"
202 " PageSystemWindowForegroundGrabFile for a description.\n"
203 "\n"
204 " The name of the file(s) grabbed to are defined by the _sfName Field, the\n"
205 " current frame number by _sfFrame. _sfIncrement can be used to automatically\n"
206 " increment the frame number after each image is written. The whole grabber can\n"
207 " be activated/deactivated using _sfActive.\n"
208 " <Field\n"
209 "\t name=\"name\"\n"
210 "\t type=\"std::string\"\n"
211 "\t cardinality=\"single\"\n"
212 "\t visibility=\"external\"\n"
213 "\t access=\"public\"\n"
214 "\t >\n"
215 "\tThe filename template. %d is replaced by the frame number.\n"
216 " </Field>\n"
217 " <Field\n"
218 "\t name=\"frame\"\n"
219 "\t type=\"UInt32\"\n"
220 "\t cardinality=\"single\"\n"
221 "\t visibility=\"external\"\n"
222 "\t defaultValue=\"0\"\n"
223 "\t access=\"public\"\n"
224 "\t >\n"
225 "\tThe frame number to use.\n"
226 " </Field>\n"
227 " <Field\n"
228 "\t name=\"increment\"\n"
229 "\t type=\"bool\"\n"
230 "\t cardinality=\"single\"\n"
231 "\t visibility=\"external\"\n"
232 "\t defaultValue=\"true\"\n"
233 "\t access=\"public\"\n"
234 "\t >\n"
235 "\tFlag to start/stop automatic frame increments after each grab.\n"
236 " </Field>\n"
237 "</FieldContainer>\n",
238 "The FileGrabForeground is used for grabbing a frame or sequence of frames to\n"
239 "disk. See \\ref\n"
240 "PageSystemWindowForegroundGrabFile for a description.\n"
241 "\n"
242 "The name of the file(s) grabbed to are defined by the _sfName Field, the\n"
243 "current frame number by _sfFrame. _sfIncrement can be used to automatically\n"
244 "increment the frame number after each image is written. The whole grabber can\n"
245 "be activated/deactivated using _sfActive.\n"
248 /*------------------------------ get -----------------------------------*/
250 FieldContainerType &FileGrabForegroundBase::getType(void)
252 return _type;
255 const FieldContainerType &FileGrabForegroundBase::getType(void) const
257 return _type;
260 UInt32 FileGrabForegroundBase::getContainerSize(void) const
262 return sizeof(FileGrabForeground);
265 /*------------------------- decorator get ------------------------------*/
268 SFString *FileGrabForegroundBase::editSFName(void)
270 editSField(NameFieldMask);
272 return &_sfName;
275 const SFString *FileGrabForegroundBase::getSFName(void) const
277 return &_sfName;
281 SFUInt32 *FileGrabForegroundBase::editSFFrame(void)
283 editSField(FrameFieldMask);
285 return &_sfFrame;
288 const SFUInt32 *FileGrabForegroundBase::getSFFrame(void) const
290 return &_sfFrame;
294 SFBool *FileGrabForegroundBase::editSFIncrement(void)
296 editSField(IncrementFieldMask);
298 return &_sfIncrement;
301 const SFBool *FileGrabForegroundBase::getSFIncrement(void) const
303 return &_sfIncrement;
311 /*------------------------------ access -----------------------------------*/
313 SizeT FileGrabForegroundBase::getBinSize(ConstFieldMaskArg whichField)
315 SizeT returnValue = Inherited::getBinSize(whichField);
317 if(FieldBits::NoField != (NameFieldMask & whichField))
319 returnValue += _sfName.getBinSize();
321 if(FieldBits::NoField != (FrameFieldMask & whichField))
323 returnValue += _sfFrame.getBinSize();
325 if(FieldBits::NoField != (IncrementFieldMask & whichField))
327 returnValue += _sfIncrement.getBinSize();
330 return returnValue;
333 void FileGrabForegroundBase::copyToBin(BinaryDataHandler &pMem,
334 ConstFieldMaskArg whichField)
336 Inherited::copyToBin(pMem, whichField);
338 if(FieldBits::NoField != (NameFieldMask & whichField))
340 _sfName.copyToBin(pMem);
342 if(FieldBits::NoField != (FrameFieldMask & whichField))
344 _sfFrame.copyToBin(pMem);
346 if(FieldBits::NoField != (IncrementFieldMask & whichField))
348 _sfIncrement.copyToBin(pMem);
352 void FileGrabForegroundBase::copyFromBin(BinaryDataHandler &pMem,
353 ConstFieldMaskArg whichField)
355 Inherited::copyFromBin(pMem, whichField);
357 if(FieldBits::NoField != (NameFieldMask & whichField))
359 editSField(NameFieldMask);
360 _sfName.copyFromBin(pMem);
362 if(FieldBits::NoField != (FrameFieldMask & whichField))
364 editSField(FrameFieldMask);
365 _sfFrame.copyFromBin(pMem);
367 if(FieldBits::NoField != (IncrementFieldMask & whichField))
369 editSField(IncrementFieldMask);
370 _sfIncrement.copyFromBin(pMem);
374 //! create a new instance of the class
375 FileGrabForegroundTransitPtr FileGrabForegroundBase::createLocal(BitVector bFlags)
377 FileGrabForegroundTransitPtr fc;
379 if(getClassType().getPrototype() != NULL)
381 FieldContainerTransitPtr tmpPtr =
382 getClassType().getPrototype()-> shallowCopyLocal(bFlags);
384 fc = dynamic_pointer_cast<FileGrabForeground>(tmpPtr);
387 return fc;
390 //! create a new instance of the class, copy the container flags
391 FileGrabForegroundTransitPtr FileGrabForegroundBase::createDependent(BitVector bFlags)
393 FileGrabForegroundTransitPtr fc;
395 if(getClassType().getPrototype() != NULL)
397 FieldContainerTransitPtr tmpPtr =
398 getClassType().getPrototype()-> shallowCopyDependent(bFlags);
400 fc = dynamic_pointer_cast<FileGrabForeground>(tmpPtr);
403 return fc;
406 //! create a new instance of the class
407 FileGrabForegroundTransitPtr FileGrabForegroundBase::create(void)
409 FileGrabForegroundTransitPtr fc;
411 if(getClassType().getPrototype() != NULL)
413 FieldContainerTransitPtr tmpPtr =
414 getClassType().getPrototype()-> shallowCopy();
416 fc = dynamic_pointer_cast<FileGrabForeground>(tmpPtr);
419 return fc;
422 FileGrabForeground *FileGrabForegroundBase::createEmptyLocal(BitVector bFlags)
424 FileGrabForeground *returnValue;
426 newPtr<FileGrabForeground>(returnValue, bFlags);
428 returnValue->_pFieldFlags->_bNamespaceMask &= ~bFlags;
430 return returnValue;
433 //! create an empty new instance of the class, do not copy the prototype
434 FileGrabForeground *FileGrabForegroundBase::createEmpty(void)
436 FileGrabForeground *returnValue;
438 newPtr<FileGrabForeground>(returnValue, Thread::getCurrentLocalFlags());
440 returnValue->_pFieldFlags->_bNamespaceMask &=
441 ~Thread::getCurrentLocalFlags();
443 return returnValue;
447 FieldContainerTransitPtr FileGrabForegroundBase::shallowCopyLocal(
448 BitVector bFlags) const
450 FileGrabForeground *tmpPtr;
452 newPtr(tmpPtr, dynamic_cast<const FileGrabForeground *>(this), bFlags);
454 FieldContainerTransitPtr returnValue(tmpPtr);
456 tmpPtr->_pFieldFlags->_bNamespaceMask &= ~bFlags;
458 return returnValue;
461 FieldContainerTransitPtr FileGrabForegroundBase::shallowCopyDependent(
462 BitVector bFlags) const
464 FileGrabForeground *tmpPtr;
466 newPtr(tmpPtr, dynamic_cast<const FileGrabForeground *>(this), ~bFlags);
468 FieldContainerTransitPtr returnValue(tmpPtr);
470 tmpPtr->_pFieldFlags->_bNamespaceMask = bFlags;
472 return returnValue;
475 FieldContainerTransitPtr FileGrabForegroundBase::shallowCopy(void) const
477 FileGrabForeground *tmpPtr;
479 newPtr(tmpPtr,
480 dynamic_cast<const FileGrabForeground *>(this),
481 Thread::getCurrentLocalFlags());
483 tmpPtr->_pFieldFlags->_bNamespaceMask &= ~Thread::getCurrentLocalFlags();
485 FieldContainerTransitPtr returnValue(tmpPtr);
487 return returnValue;
493 /*------------------------- constructors ----------------------------------*/
495 FileGrabForegroundBase::FileGrabForegroundBase(void) :
496 Inherited(),
497 _sfName (),
498 _sfFrame (UInt32(0)),
499 _sfIncrement (bool(true))
503 FileGrabForegroundBase::FileGrabForegroundBase(const FileGrabForegroundBase &source) :
504 Inherited(source),
505 _sfName (source._sfName ),
506 _sfFrame (source._sfFrame ),
507 _sfIncrement (source._sfIncrement )
512 /*-------------------------- destructors ----------------------------------*/
514 FileGrabForegroundBase::~FileGrabForegroundBase(void)
519 GetFieldHandlePtr FileGrabForegroundBase::getHandleName (void) const
521 SFString::GetHandlePtr returnValue(
522 new SFString::GetHandle(
523 &_sfName,
524 this->getType().getFieldDesc(NameFieldId),
525 const_cast<FileGrabForegroundBase *>(this)));
527 return returnValue;
530 EditFieldHandlePtr FileGrabForegroundBase::editHandleName (void)
532 SFString::EditHandlePtr returnValue(
533 new SFString::EditHandle(
534 &_sfName,
535 this->getType().getFieldDesc(NameFieldId),
536 this));
539 editSField(NameFieldMask);
541 return returnValue;
544 GetFieldHandlePtr FileGrabForegroundBase::getHandleFrame (void) const
546 SFUInt32::GetHandlePtr returnValue(
547 new SFUInt32::GetHandle(
548 &_sfFrame,
549 this->getType().getFieldDesc(FrameFieldId),
550 const_cast<FileGrabForegroundBase *>(this)));
552 return returnValue;
555 EditFieldHandlePtr FileGrabForegroundBase::editHandleFrame (void)
557 SFUInt32::EditHandlePtr returnValue(
558 new SFUInt32::EditHandle(
559 &_sfFrame,
560 this->getType().getFieldDesc(FrameFieldId),
561 this));
564 editSField(FrameFieldMask);
566 return returnValue;
569 GetFieldHandlePtr FileGrabForegroundBase::getHandleIncrement (void) const
571 SFBool::GetHandlePtr returnValue(
572 new SFBool::GetHandle(
573 &_sfIncrement,
574 this->getType().getFieldDesc(IncrementFieldId),
575 const_cast<FileGrabForegroundBase *>(this)));
577 return returnValue;
580 EditFieldHandlePtr FileGrabForegroundBase::editHandleIncrement (void)
582 SFBool::EditHandlePtr returnValue(
583 new SFBool::EditHandle(
584 &_sfIncrement,
585 this->getType().getFieldDesc(IncrementFieldId),
586 this));
589 editSField(IncrementFieldMask);
591 return returnValue;
595 #ifdef OSG_MT_CPTR_ASPECT
596 void FileGrabForegroundBase::execSyncV( FieldContainer &oFrom,
597 ConstFieldMaskArg whichField,
598 AspectOffsetStore &oOffsets,
599 ConstFieldMaskArg syncMode,
600 const UInt32 uiSyncInfo)
602 FileGrabForeground *pThis = static_cast<FileGrabForeground *>(this);
604 pThis->execSync(static_cast<FileGrabForeground *>(&oFrom),
605 whichField,
606 oOffsets,
607 syncMode,
608 uiSyncInfo);
610 #endif
613 #ifdef OSG_MT_CPTR_ASPECT
614 FieldContainer *FileGrabForegroundBase::createAspectCopy(
615 const FieldContainer *pRefAspect) const
617 FileGrabForeground *returnValue;
619 newAspectCopy(returnValue,
620 dynamic_cast<const FileGrabForeground *>(pRefAspect),
621 dynamic_cast<const FileGrabForeground *>(this));
623 return returnValue;
625 #endif
627 void FileGrabForegroundBase::resolveLinks(void)
629 Inherited::resolveLinks();
635 OSG_END_NAMESPACE