Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

osg::FileGrabForegroundBase Class Reference

FileGrabForeground Base Class.

#include <OSGFileGrabForegroundBase.h>

Inheritance diagram for osg::FileGrabForegroundBase:

osg::GrabForeground osg::GrabForegroundBase osg::Foreground osg::ForegroundBase osg::AttachmentContainer osg::FieldContainer osg::FileGrabForeground List of all members.

Public Types

typedef FileGrabForegroundPtr Ptr
enum  { NameFieldId = Inherited::NextFieldId, FrameFieldId = NameFieldId + 1, IncrementFieldId = FrameFieldId + 1, NextFieldId = IncrementFieldId + 1 }

Public Member Functions

FieldContainer Get
*virtual FieldContainerTypegetType (void)
virtual const FieldContainerTypegetType (void) const
virtual UInt32 getContainerSize (void) const
Field Get
*SFStringgetSFName (void)
 Get the FileGrabForeground::_sfName field.
SFUInt32getSFFrame (void)
 Get the FileGrabForeground::_sfFrame field.
SFBoolgetSFIncrement (void)
 Get the FileGrabForeground::_sfIncrement field.
std::string & getName (void)
 Get the value of the FileGrabForeground::_sfName field.
const std::string & getName (void) const
 Get the value of the FileGrabForeground::_sfName field.
UInt32getFrame (void)
 Get the value of the FileGrabForeground::_sfFrame field.
const UInt32getFrame (void) const
 Get the value of the FileGrabForeground::_sfFrame field.
bool & getIncrement (void)
 Get the value of the FileGrabForeground::_sfIncrement field.
const bool & getIncrement (void) const
 Get the value of the FileGrabForeground::_sfIncrement field.
Field Set
*void setName (const std::string &value)
 Set the value of the FileGrabForeground::_sfName field.
void setFrame (const UInt32 &value)
 Set the value of the FileGrabForeground::_sfFrame field.
void setIncrement (const bool &value)
 Set the value of the FileGrabForeground::_sfIncrement field.
Binary Access
*virtual UInt32 getBinSize (const BitVector &whichField)
virtual void copyToBin (BinaryDataHandler &pMem, const BitVector &whichField)
virtual void copyFromBin (BinaryDataHandler &pMem, const BitVector &whichField)
Copy
*virtual FieldContainerPtr shallowCopy (void) const
Sync
*virtual void changed (BitVector whichField, UInt32 origin)
Output
*virtual void dump (UInt32 uiIndent=0, const BitVector bvFlags=0) const
draw
*virtual void draw (DrawActionBase *action, Viewport *port)
Field Get
*SFImagePtrgetSFImage (void)
 Get the GrabForeground::_sfImage field.
SFBoolgetSFAutoResize (void)
 Get the GrabForeground::_sfAutoResize field.
ImagePtrgetImage (void)
 Get the value of the GrabForeground::_sfImage field.
const ImagePtrgetImage (void) const
 Get the value of the GrabForeground::_sfImage field.
bool & getAutoResize (void)
 Get the value of the GrabForeground::_sfAutoResize field.
const bool & getAutoResize (void) const
 Get the value of the GrabForeground::_sfAutoResize field.
Field Set
*void setImage (const ImagePtr &value)
 Set the value of the GrabForeground::_sfImage field.
void setAutoResize (const bool &value)
 Set the value of the GrabForeground::_sfAutoResize field.

Static Public Member Functions

Class Get
*static FieldContainerTypegetClassType (void)
 access the type of the class
static UInt32 getClassTypeId (void)
 access the numerical type of the class
Construction
*static FileGrabForegroundPtr create (void)
 create a new instance of the class
static FileGrabForegroundPtr createEmpty (void)
 create an empty new instance of the class, do not copy the prototype

Static Public Attributes

static const osg::BitVector NameFieldMask
static const osg::BitVector FrameFieldMask
static const osg::BitVector IncrementFieldMask
static const osg::BitVector MTInfluenceMask
static const osg::BitVector ImageFieldMask
static const osg::BitVector AutoResizeFieldMask
static const osg::BitVector ActiveFieldMask
static const BitVector AttachmentsFieldMask
static const BitVector NextFieldMask

Protected Member Functions

Constructors
FileGrabForegroundBase (void)
 FileGrabForegroundBase (const FileGrabForegroundBase &source)
Destructors
*virtual ~FileGrabForegroundBase (void)
Sync
*void executeSyncImpl (FileGrabForegroundBase *pOther, const BitVector &whichField)
virtual void executeSync (FieldContainer &other, const BitVector &whichField)
Sync
*void executeSyncImpl (GrabForegroundBase *pOther, const BitVector &whichField)

Protected Attributes

Fields
*SFString _sfName
SFUInt32 _sfFrame
SFBool _sfIncrement
Fields
*SFImagePtr _sfImage
SFBool _sfAutoResize

Private Types

typedef GrabForeground Inherited

Private Member Functions

void operator= (const FileGrabForegroundBase &source)

Static Private Attributes

static FieldDescription_desc []
 FileGrabForeground description.
static FieldContainerType _type

Friends

class FieldContainer

Detailed Description

Definition at line 83 of file OSGFileGrabForegroundBase.h.


Member Typedef Documentation

typedef GrabForeground osg::FileGrabForegroundBase::Inherited [private]
 

Reimplemented from osg::GrabForeground.

Reimplemented in osg::FileGrabForeground.

Definition at line 87 of file OSGFileGrabForegroundBase.h.

typedef FileGrabForegroundPtr osg::FileGrabForegroundBase::Ptr
 

Reimplemented from osg::GrabForegroundBase.

Definition at line 92 of file OSGFileGrabForegroundBase.h.


Member Enumeration Documentation

anonymous enum
 

Enumerator:
NameFieldId 
FrameFieldId 
IncrementFieldId 
NextFieldId 

Reimplemented from osg::GrabForegroundBase.

Definition at line 94 of file OSGFileGrabForegroundBase.h.

00095     {
00096         NameFieldId      = Inherited::NextFieldId,
00097         FrameFieldId     = NameFieldId      + 1,
00098         IncrementFieldId = FrameFieldId     + 1,
00099         NextFieldId      = IncrementFieldId + 1
00100     };


Constructor & Destructor Documentation

FileGrabForegroundBase::FileGrabForegroundBase void   )  [protected]
 

Definition at line 186 of file OSGFileGrabForegroundBase.cpp.

00186                                                    :
00187     _sfName                   (), 
00188     _sfFrame                  (UInt32(0)), 
00189     _sfIncrement              (bool(true)), 
00190     Inherited() 
00191 {
00192 }

FileGrabForegroundBase::FileGrabForegroundBase const FileGrabForegroundBase source  )  [protected]
 

Definition at line 198 of file OSGFileGrabForegroundBase.cpp.

00198                                                                                    :
00199     _sfName                   (source._sfName                   ), 
00200     _sfFrame                  (source._sfFrame                  ), 
00201     _sfIncrement              (source._sfIncrement              ), 
00202     Inherited                 (source)
00203 {
00204 }

FileGrabForegroundBase::~FileGrabForegroundBase void   )  [protected, virtual]
 

Definition at line 208 of file OSGFileGrabForegroundBase.cpp.

00209 {
00210 }


Member Function Documentation

osg::FieldContainerType & osg::FileGrabForegroundBase::getClassType void   )  [inline, static]
 

Reimplemented from osg::GrabForegroundBase.

Definition at line 58 of file OSGFileGrabForegroundBase.inl.

References _type.

Referenced by create().

00059 {
00060     return _type; 
00061 } 

osg::UInt32 osg::FileGrabForegroundBase::getClassTypeId void   )  [inline, static]
 

Reimplemented from osg::GrabForegroundBase.

Definition at line 65 of file OSGFileGrabForegroundBase.inl.

References _type, and osg::TypeBase::getId().

00066 {
00067     return _type.getId(); 
00068 } 

FieldContainerType & FileGrabForegroundBase::getType void   )  [virtual]
 

Reimplemented from osg::GrabForegroundBase.

Definition at line 128 of file OSGFileGrabForegroundBase.cpp.

References _type.

00129 {
00130     return _type; 
00131 } 

const FieldContainerType & FileGrabForegroundBase::getType void   )  const [virtual]
 

Reimplemented from osg::GrabForegroundBase.

Definition at line 133 of file OSGFileGrabForegroundBase.cpp.

References _type.

00134 {
00135     return _type;
00136 } 

UInt32 FileGrabForegroundBase::getContainerSize void   )  const [virtual]
 

Reimplemented from osg::GrabForegroundBase.

Definition at line 148 of file OSGFileGrabForegroundBase.cpp.

00149 { 
00150     return sizeof(FileGrabForeground); 
00151 }

SFString * osg::FileGrabForegroundBase::getSFName void   )  [inline]
 

Definition at line 101 of file OSGFileGrabForegroundBase.inl.

References _sfName.

00102 {
00103     return &_sfName;
00104 }

SFUInt32 * osg::FileGrabForegroundBase::getSFFrame void   )  [inline]
 

Definition at line 108 of file OSGFileGrabForegroundBase.inl.

References _sfFrame.

00109 {
00110     return &_sfFrame;
00111 }

SFBool * osg::FileGrabForegroundBase::getSFIncrement void   )  [inline]
 

Definition at line 115 of file OSGFileGrabForegroundBase.inl.

References _sfIncrement.

00116 {
00117     return &_sfIncrement;
00118 }

std::string & osg::FileGrabForegroundBase::getName void   )  [inline]
 

Definition at line 123 of file OSGFileGrabForegroundBase.inl.

References _sfName, and osg::SField< FieldTypeT, fieldNameSpace >::getValue().

Referenced by osg::FileGrabForeground::draw().

00124 {
00125     return _sfName.getValue();
00126 }

const std::string & osg::FileGrabForegroundBase::getName void   )  const [inline]
 

Definition at line 130 of file OSGFileGrabForegroundBase.inl.

References _sfName, and osg::SField< FieldTypeT, fieldNameSpace >::getValue().

00131 {
00132     return _sfName.getValue();
00133 }

UInt32 & osg::FileGrabForegroundBase::getFrame void   )  [inline]
 

Definition at line 144 of file OSGFileGrabForegroundBase.inl.

References _sfFrame, and osg::SField< FieldTypeT, fieldNameSpace >::getValue().

Referenced by osg::FileGrabForeground::draw().

00145 {
00146     return _sfFrame.getValue();
00147 }

const UInt32 & osg::FileGrabForegroundBase::getFrame void   )  const [inline]
 

Definition at line 151 of file OSGFileGrabForegroundBase.inl.

References _sfFrame, and osg::SField< FieldTypeT, fieldNameSpace >::getValue().

00152 {
00153     return _sfFrame.getValue();
00154 }

bool & osg::FileGrabForegroundBase::getIncrement void   )  [inline]
 

Definition at line 165 of file OSGFileGrabForegroundBase.inl.

References _sfIncrement, and osg::SField< FieldTypeT, fieldNameSpace >::getValue().

Referenced by osg::FileGrabForeground::draw().

00166 {
00167     return _sfIncrement.getValue();
00168 }

const bool & osg::FileGrabForegroundBase::getIncrement void   )  const [inline]
 

Definition at line 172 of file OSGFileGrabForegroundBase.inl.

References _sfIncrement, and osg::SField< FieldTypeT, fieldNameSpace >::getValue().

00173 {
00174     return _sfIncrement.getValue();
00175 }

void osg::FileGrabForegroundBase::setName const std::string &  value  )  [inline]
 

Definition at line 137 of file OSGFileGrabForegroundBase.inl.

References _sfName, and osg::SField< FieldTypeT, fieldNameSpace >::setValue().

00138 {
00139     _sfName.setValue(value);
00140 }

void osg::FileGrabForegroundBase::setFrame const UInt32 value  )  [inline]
 

Definition at line 158 of file OSGFileGrabForegroundBase.inl.

References _sfFrame, and osg::SField< FieldTypeT, fieldNameSpace >::setValue().

Referenced by osg::FileGrabForeground::draw().

00159 {
00160     _sfFrame.setValue(value);
00161 }

void osg::FileGrabForegroundBase::setIncrement const bool &  value  )  [inline]
 

Definition at line 179 of file OSGFileGrabForegroundBase.inl.

References _sfIncrement, and osg::SField< FieldTypeT, fieldNameSpace >::setValue().

00180 {
00181     _sfIncrement.setValue(value);
00182 }

UInt32 FileGrabForegroundBase::getBinSize const BitVector whichField  )  [virtual]
 

Reimplemented from osg::GrabForegroundBase.

Definition at line 214 of file OSGFileGrabForegroundBase.cpp.

References _sfFrame, _sfIncrement, _sfName, FrameFieldMask, osg::SField< FieldTypeT, fieldNameSpace >::getBinSize(), osg::GrabForegroundBase::getBinSize(), IncrementFieldMask, NameFieldMask, and osg::FieldBits::NoField.

00215 {
00216     UInt32 returnValue = Inherited::getBinSize(whichField);
00217 
00218     if(FieldBits::NoField != (NameFieldMask & whichField))
00219     {
00220         returnValue += _sfName.getBinSize();
00221     }
00222 
00223     if(FieldBits::NoField != (FrameFieldMask & whichField))
00224     {
00225         returnValue += _sfFrame.getBinSize();
00226     }
00227 
00228     if(FieldBits::NoField != (IncrementFieldMask & whichField))
00229     {
00230         returnValue += _sfIncrement.getBinSize();
00231     }
00232 
00233 
00234     return returnValue;
00235 }

void FileGrabForegroundBase::copyToBin BinaryDataHandler pMem,
const BitVector whichField
[virtual]
 

Reimplemented from osg::GrabForegroundBase.

Definition at line 237 of file OSGFileGrabForegroundBase.cpp.

References _sfFrame, _sfIncrement, _sfName, osg::SField< FieldTypeT, fieldNameSpace >::copyToBin(), osg::GrabForegroundBase::copyToBin(), FrameFieldMask, IncrementFieldMask, NameFieldMask, and osg::FieldBits::NoField.

00239 {
00240     Inherited::copyToBin(pMem, whichField);
00241 
00242     if(FieldBits::NoField != (NameFieldMask & whichField))
00243     {
00244         _sfName.copyToBin(pMem);
00245     }
00246 
00247     if(FieldBits::NoField != (FrameFieldMask & whichField))
00248     {
00249         _sfFrame.copyToBin(pMem);
00250     }
00251 
00252     if(FieldBits::NoField != (IncrementFieldMask & whichField))
00253     {
00254         _sfIncrement.copyToBin(pMem);
00255     }
00256 
00257 
00258 }

void FileGrabForegroundBase::copyFromBin BinaryDataHandler pMem,
const BitVector whichField
[virtual]
 

Reimplemented from osg::GrabForegroundBase.

Definition at line 260 of file OSGFileGrabForegroundBase.cpp.

References _sfFrame, _sfIncrement, _sfName, osg::SField< FieldTypeT, fieldNameSpace >::copyFromBin(), osg::GrabForegroundBase::copyFromBin(), FrameFieldMask, IncrementFieldMask, NameFieldMask, and osg::FieldBits::NoField.

00262 {
00263     Inherited::copyFromBin(pMem, whichField);
00264 
00265     if(FieldBits::NoField != (NameFieldMask & whichField))
00266     {
00267         _sfName.copyFromBin(pMem);
00268     }
00269 
00270     if(FieldBits::NoField != (FrameFieldMask & whichField))
00271     {
00272         _sfFrame.copyFromBin(pMem);
00273     }
00274 
00275     if(FieldBits::NoField != (IncrementFieldMask & whichField))
00276     {
00277         _sfIncrement.copyFromBin(pMem);
00278     }
00279 
00280 
00281 }

FileGrabForegroundPtr osg::FileGrabForegroundBase::create void   )  [inline, static]
 

Reimplemented from osg::GrabForegroundBase.

Definition at line 72 of file OSGFileGrabForegroundBase.inl.

References osg::AttachmentContainerPtr::dcast(), getClassType(), osg::FieldContainerType::getPrototype(), osg::NullFC, and shallowCopy().

00073 {
00074     FileGrabForegroundPtr fc; 
00075 
00076     if(getClassType().getPrototype() != OSG::NullFC) 
00077     {
00078         fc = FileGrabForegroundPtr::dcast(
00079             getClassType().getPrototype()-> shallowCopy()); 
00080     }
00081     
00082     return fc; 
00083 }

FileGrabForegroundPtr osg::FileGrabForegroundBase::createEmpty void   )  [inline, static]
 

Reimplemented from osg::GrabForegroundBase.

Definition at line 87 of file OSGFileGrabForegroundBase.inl.

References osg::FieldContainer::newPtr().

00088 { 
00089     FileGrabForegroundPtr returnValue; 
00090     
00091     newPtr(returnValue); 
00092 
00093     return returnValue; 
00094 }

FieldContainerPtr FileGrabForegroundBase::shallowCopy void   )  const [virtual]
 

Reimplemented from osg::GrabForegroundBase.

Definition at line 139 of file OSGFileGrabForegroundBase.cpp.

References osg::FieldContainer::newPtr().

Referenced by create().

00140 { 
00141     FileGrabForegroundPtr returnValue; 
00142 
00143     newPtr(returnValue, dynamic_cast<const FileGrabForeground *>(this)); 
00144 
00145     return returnValue; 
00146 }

void FileGrabForegroundBase::executeSyncImpl FileGrabForegroundBase pOther,
const BitVector whichField
[protected]
 

Definition at line 284 of file OSGFileGrabForegroundBase.cpp.

References _sfFrame, _sfIncrement, _sfName, osg::GrabForegroundBase::executeSyncImpl(), FrameFieldMask, IncrementFieldMask, NameFieldMask, osg::FieldBits::NoField, and osg::SField< FieldTypeT, fieldNameSpace >::syncWith().

Referenced by executeSync().

00286 {
00287 
00288     Inherited::executeSyncImpl(pOther, whichField);
00289 
00290     if(FieldBits::NoField != (NameFieldMask & whichField))
00291         _sfName.syncWith(pOther->_sfName);
00292 
00293     if(FieldBits::NoField != (FrameFieldMask & whichField))
00294         _sfFrame.syncWith(pOther->_sfFrame);
00295 
00296     if(FieldBits::NoField != (IncrementFieldMask & whichField))
00297         _sfIncrement.syncWith(pOther->_sfIncrement);
00298 
00299 
00300 }

void FileGrabForegroundBase::executeSync FieldContainer other,
const BitVector whichField
[protected, virtual]
 

Reimplemented from osg::GrabForegroundBase.

Definition at line 155 of file OSGFileGrabForegroundBase.cpp.

References executeSyncImpl().

00157 {
00158     this->executeSyncImpl((FileGrabForegroundBase *) &other, whichField);
00159 }

void osg::FileGrabForegroundBase::operator= const FileGrabForegroundBase source  )  [private]
 

void GrabForeground::changed BitVector  whichField,
UInt32  origin
[virtual, inherited]
 

Reimplemented from osg::Foreground.

Reimplemented in osg::FileGrabForeground.

Definition at line 95 of file OSGGrabForeground.cpp.

References osg::Foreground::changed().

Referenced by osg::FileGrabForeground::changed().

00096 {
00097     Inherited::changed(whichField, origin);
00098 }

void GrabForeground::dump UInt32  uiIndent = 0,
const BitVector  bvFlags = 0
const [virtual, inherited]
 

Reimplemented from osg::Foreground.

Reimplemented in osg::FileGrabForeground.

Definition at line 100 of file OSGGrabForeground.cpp.

References SLOG.

00102 {
00103     SLOG << "Dump GrabForeground NI" << std::endl;
00104 }

void GrabForeground::draw DrawActionBase action,
Viewport port
[virtual, inherited]
 

Grab the image, if it is actually set.

Implements osg::Foreground.

Reimplemented in osg::FileGrabForeground.

Definition at line 109 of file OSGGrabForeground.cpp.

References osg::ForegroundBase::getActive(), osg::GrabForegroundBase::getAutoResize(), osg::GrabForegroundBase::getImage(), osg::Viewport::getPixelBottom(), osg::Viewport::getPixelHeight(), osg::Viewport::getPixelLeft(), osg::Viewport::getPixelWidth(), osg::NullFC, osg::osgMax(), and osg::osgMin().

Referenced by osg::FileGrabForeground::draw().

00110 {
00111     if(getActive() == false)
00112         return;
00113     
00114     ImagePtr i = getImage();
00115     
00116     if(i == NullFC)       // No image, no grab.
00117         return;
00118 
00119     UInt32 w = osgMax(2, port->getPixelWidth());
00120     UInt32 h = osgMax(2, port->getPixelHeight());
00121     
00122     // If image is smaller than 2x2, resize it to vp size
00123     // the 2x2 is because you can't create 0x0 images
00124     // If autoResize then update img size if vp changed
00125     if ( (i->getWidth() <= 1 || i->getHeight() <= 1) ||
00126          (getAutoResize() && (w != i->getWidth() || h != i->getHeight())) )
00127     {
00128         i->set(i->getPixelFormat(), w, h);
00129     }
00130     
00131     bool storeChanged = false;
00132 
00133     if ( !getAutoResize() )
00134     {
00135         w = osgMin(i->getWidth(),  port->getPixelWidth());
00136         h = osgMin(i->getHeight(), port->getPixelHeight());
00137         
00138         if (i->getWidth() != port->getPixelWidth())
00139         {
00140             glPixelStorei(GL_PACK_ROW_LENGTH, i->getWidth());
00141             storeChanged = true;
00142         }
00143     }
00144     
00145     glReadPixels(port->getPixelLeft(), port->getPixelBottom(), 
00146                  w, h, i->getPixelFormat(),
00147                  GL_UNSIGNED_BYTE, i->getData());
00148 
00149     if(storeChanged)
00150         glPixelStorei(GL_PACK_ROW_LENGTH, 0);
00151 }

SFImagePtr * osg::GrabForegroundBase::getSFImage void   )  [inline, inherited]
 

Definition at line 101 of file OSGGrabForegroundBase.inl.

References osg::GrabForegroundBase::_sfImage.

00102 {
00103     return &_sfImage;
00104 }

SFBool * osg::GrabForegroundBase::getSFAutoResize void   )  [inline, inherited]
 

Definition at line 108 of file OSGGrabForegroundBase.inl.

References osg::GrabForegroundBase::_sfAutoResize.

00109 {
00110     return &_sfAutoResize;
00111 }

ImagePtr & osg::GrabForegroundBase::getImage void   )  [inline, inherited]
 

Definition at line 116 of file OSGGrabForegroundBase.inl.

References osg::GrabForegroundBase::_sfImage, and osg::SField< FieldTypeT, fieldNameSpace >::getValue().

Referenced by osg::GrabForeground::draw(), and osg::FileGrabForeground::draw().

00117 {
00118     return _sfImage.getValue();
00119 }

const ImagePtr & osg::GrabForegroundBase::getImage void   )  const [inline, inherited]
 

Definition at line 123 of file OSGGrabForegroundBase.inl.

References osg::GrabForegroundBase::_sfImage, and osg::SField< FieldTypeT, fieldNameSpace >::getValue().

00124 {
00125     return _sfImage.getValue();
00126 }

bool & osg::GrabForegroundBase::getAutoResize void   )  [inline, inherited]
 

Definition at line 137 of file OSGGrabForegroundBase.inl.

References osg::GrabForegroundBase::_sfAutoResize, and osg::SField< FieldTypeT, fieldNameSpace >::getValue().

Referenced by osg::GrabForeground::draw().

00138 {
00139     return _sfAutoResize.getValue();
00140 }

const bool & osg::GrabForegroundBase::getAutoResize void   )  const [inline, inherited]
 

Definition at line 144 of file OSGGrabForegroundBase.inl.

References osg::GrabForegroundBase::_sfAutoResize, and osg::SField< FieldTypeT, fieldNameSpace >::getValue().

00145 {
00146     return _sfAutoResize.getValue();
00147 }

void osg::GrabForegroundBase::setImage const ImagePtr value  )  [inline, inherited]
 

Definition at line 130 of file OSGGrabForegroundBase.inl.

References osg::GrabForegroundBase::_sfImage, and osg::SField< FieldTypeT, fieldNameSpace >::setValue().

Referenced by osg::FileGrabForeground::draw().

00131 {
00132     _sfImage.setValue(value);
00133 }

void osg::GrabForegroundBase::setAutoResize const bool &  value  )  [inline, inherited]
 

Definition at line 151 of file OSGGrabForegroundBase.inl.

References osg::GrabForegroundBase::_sfAutoResize, and osg::SField< FieldTypeT, fieldNameSpace >::setValue().

00152 {
00153     _sfAutoResize.setValue(value);
00154 }