Geant4-11
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes
SoCounterAction Class Reference

#include <SoCounterAction.h>

Inheritance diagram for SoCounterAction:

Public Types

enum  LookFor { NODE = 1 , TYPE = 2 , NAME = 3 }
 

Public Member Functions

int getCount () const
 
void setLookFor (LookFor)
 
void setType (const SoType, SbBool=TRUE)
 
 SoCounterAction ()
 
virtual ~SoCounterAction ()
 

Static Public Member Functions

static void initClass (void)
 

Protected Member Functions

virtual void beginTraversal (SoNode *)
 

Private Member Functions

 SO_ACTION_HEADER (SoCounterAction)
 

Static Private Member Functions

static void actionMethod (SoAction *, SoNode *)
 

Private Attributes

SbBool fCheckDerived
 
int fCount
 
int fLookFor
 
SbName fName
 
SoType fType
 

Detailed Description

Definition at line 36 of file SoCounterAction.h.

Member Enumeration Documentation

◆ LookFor

Enumerator
NODE 
TYPE 
NAME 

Definition at line 42 of file SoCounterAction.h.

Constructor & Destructor Documentation

◆ SoCounterAction()

SoCounterAction::SoCounterAction ( )

Definition at line 56 of file SoCounterAction.cc.

58 SO_ACTION_CONSTRUCTOR(SoCounterAction);
59}
#define TRUE
Definition: Globals.hh:27

◆ ~SoCounterAction()

SoCounterAction::~SoCounterAction ( )
virtual

Definition at line 60 of file SoCounterAction.cc.

60{}

Member Function Documentation

◆ actionMethod()

void SoCounterAction::actionMethod ( SoAction *  aThis,
SoNode *  aNode 
)
staticprivate

Definition at line 65 of file SoCounterAction.cc.

65 {
66 //printf("debug : begin : %s %s\n",aNode->getName().getString(),
67 //aNode->getTypeId().getName().getString());
68 SoCounterAction* This = (SoCounterAction*)aThis;
69 if(This->fLookFor==NODE) {
70 This->fCount++;
71 } else if(This->fLookFor==TYPE) {
72 if(This->fCheckDerived==TRUE) {
73 if(aNode->getTypeId().isDerivedFrom(This->fType)) This->fCount++;
74 } else {
75 if(aNode->getTypeId()==This->fType) This->fCount++;
76 }
77 } else if(This->fLookFor==NAME) {
78 if(This->fName==aNode->getName()) This->fCount++;
79 }
80 if(aNode->isOfType(SoSwitch::getClassTypeId())) {
81 SoSwitch* sw = (SoSwitch*)aNode;
82 SbBool flag = sw->whichChild.enableNotify(FALSE);
83 int old = sw->whichChild.getValue();
84 sw->whichChild.setValue(SO_SWITCH_ALL);
85 aNode->doAction(aThis);
86 sw->whichChild.setValue(old);
87 sw->whichChild.enableNotify(flag);
88 } else if(aNode->isOfType(SoGroup::getClassTypeId())) {
89 aNode->doAction(aThis);
90 } else if(aNode->isOfType(SoBaseKit::getClassTypeId())) {
91 aNode->doAction(aThis);
92 }
93}
#define FALSE
Definition: Globals.hh:23

References FALSE, fCheckDerived, fCount, fLookFor, fName, fType, NAME, NODE, TRUE, and TYPE.

Referenced by initClass().

◆ beginTraversal()

void SoCounterAction::beginTraversal ( SoNode *  node)
protectedvirtual

Definition at line 61 of file SoCounterAction.cc.

61 {
62 fCount = 0;
63 SoAction::beginTraversal(node);
64}

References fCount.

◆ getCount()

int SoCounterAction::getCount ( ) const

Definition at line 104 of file SoCounterAction.cc.

104 {
105 return fCount;
106}

References fCount.

Referenced by G4OpenInventorViewer::SceneGraphStatistics().

◆ initClass()

void SoCounterAction::initClass ( void  )
static

Definition at line 45 of file SoCounterAction.cc.

45 {
46 static bool first = true;
47 if (first) {
48 first = false;
49 SO_ACTION_INIT_CLASS(SoCounterAction,SoAction);
50
51 SO_ENABLE(SoCounterAction,SoSwitchElement);
52
53 SO_ACTION_ADD_METHOD(SoNode,SoCounterAction::actionMethod);
54 }
55}
static void actionMethod(SoAction *, SoNode *)

References actionMethod().

Referenced by G4OpenInventor::InitNodes().

◆ setLookFor()

void SoCounterAction::setLookFor ( LookFor  aLookFor)

Definition at line 94 of file SoCounterAction.cc.

94 {
95 fLookFor = aLookFor;
96}

References fLookFor.

Referenced by G4OpenInventorViewer::SceneGraphStatistics().

◆ setType()

void SoCounterAction::setType ( const SoType  aType,
SbBool  aCheckDerived = TRUE 
)

Definition at line 97 of file SoCounterAction.cc.

97 {
98 fType = aType;
99 fCheckDerived = aCheckDerived;
100}

References fCheckDerived, and fType.

Referenced by G4OpenInventorViewer::SceneGraphStatistics().

◆ SO_ACTION_HEADER()

SoCounterAction::SO_ACTION_HEADER ( SoCounterAction  )
private

Field Documentation

◆ fCheckDerived

SbBool SoCounterAction::fCheckDerived
private

Definition at line 57 of file SoCounterAction.h.

Referenced by actionMethod(), and setType().

◆ fCount

int SoCounterAction::fCount
private

Definition at line 53 of file SoCounterAction.h.

Referenced by actionMethod(), beginTraversal(), and getCount().

◆ fLookFor

int SoCounterAction::fLookFor
private

Definition at line 54 of file SoCounterAction.h.

Referenced by actionMethod(), and setLookFor().

◆ fName

SbName SoCounterAction::fName
private

Definition at line 55 of file SoCounterAction.h.

Referenced by actionMethod().

◆ fType

SoType SoCounterAction::fType
private

Definition at line 56 of file SoCounterAction.h.

Referenced by actionMethod(), and setType().


The documentation for this class was generated from the following files: