/usr/include/ossim/base/ossimVisitor.h is in libossim-dev 2.2.2-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 | // $Id: ossimVisitor.h 22790 2014-05-16 19:19:30Z gpotts $
#ifndef ossimVisitor_HEADER
#define ossimVisitor_HEADER 1
#include <ossim/base/ossimObject.h>
#include <ossim/base/ossimString.h>
#include <ossim/base/ossimId.h>
#include <ossim/base/ossimEvent.h>
#include <ossim/base/ossimRefPtr.h>
#include <set>
#include <vector>
class ossimConnectableObject;
class OSSIM_DLL ossimVisitor : public ossimReferenced
{
public:
typedef std::set<ossimRefPtr<ossimObject> > MarkCollectionRef;
typedef std::set<ossimRefPtr<ossimObject> > CollectionRef;
typedef std::vector<ossimRefPtr<ossimObject> > ListRef;
typedef std::set<ossimObject*> Collection;
typedef std::vector<ossimObject* > List;
/**
* Enumeration type can be a mask and will traverse a graph of connectables based on the values.
*/
enum VisitorType
{
VISIT_NONE = 0,
VISIT_CHILDREN = 1,
VISIT_INPUTS = 2,
VISIT_OUTPUTS = 4,
VISIT_ALL = (VISIT_CHILDREN|VISIT_INPUTS|VISIT_OUTPUTS)
};
ossimVisitor(int visitorType = VISIT_NONE);
ossimVisitor(const ossimVisitor& src);
virtual void reset();
virtual ossimRefPtr<ossimVisitor> dup()const=0;
virtual void visit(ossimObject* obj);
virtual void visit(ossimConnectableObject* obj);
VisitorType getVisitorType()const;
void setVisitorType(int vType, bool on=true);
void turnOffVisitorType(int vType);
bool hasVisited(ossimObject* obj)const;
bool stopTraversal()const;
protected:
VisitorType m_visitorType;
mutable Collection m_markNode;
mutable bool m_stopTraversalFlag;
};
class OSSIM_DLL ossimCollectionVisitor : public ossimVisitor
{
public:
ossimCollectionVisitor(int visitorType =(VISIT_INPUTS|VISIT_CHILDREN));
ossimCollectionVisitor(const ossimCollectionVisitor& src);
ListRef& getObjects();
const ListRef& getObjects()const;
ossimObject* getObject(ossim_uint32 idx = 0);
const ossimObject* getObject(ossim_uint32 idx = 0)const;
// Inlined to force template instantiation.
template <class T> T* getObjectAs(ossim_uint32 idx=0)
{
if(idx < m_collection.size())
{
return dynamic_cast<T*>(m_collection[idx].get());
}
return 0;
}
// Inlined to force template instantiation.
template<class T> const T* getObjectAs(ossim_uint32 idx=0)const
{
if(idx < m_collection.size())
{
return dynamic_cast<const T*>(m_collection[idx].get());
}
return 0;
}
virtual void reset();
protected:
ListRef m_collection;
};
class OSSIM_DLL ossimIdVisitor : public ossimVisitor
{
public:
/**
* @brief Default constructor
* Constructs with id of 0 and vistor type of VISIT_INPUTS|VISIT_CHILDREN.
*/
ossimIdVisitor();
ossimIdVisitor(int visitorType);
ossimIdVisitor(const ossimId& id, int visitorType =(VISIT_INPUTS|VISIT_CHILDREN));
ossimIdVisitor(const ossimIdVisitor& src);
virtual ossimRefPtr<ossimVisitor> dup()const;
virtual void visit(ossimConnectableObject* obj);
/** @brief Resets m_object to 0, calls ossimVisitor::reset(). */
virtual void reset();
ossimConnectableObject* getObject();
const ossimConnectableObject* getObject()const;
void setId(const ossimId& id);
const ossimId& getId()const;
protected:
ossimConnectableObject* m_object;
ossimId m_id;
};
class OSSIM_DLL ossimTypeNameVisitor : public ossimCollectionVisitor
{
public:
ossimTypeNameVisitor(int visitorType =(VISIT_INPUTS|VISIT_CHILDREN));
ossimTypeNameVisitor(const ossimString& typeName, bool firstofTypeFlag=false, int visitorType =(VISIT_INPUTS|VISIT_CHILDREN));
ossimTypeNameVisitor(const ossimTypeNameVisitor& src);
virtual ossimRefPtr<ossimVisitor> dup()const;
virtual void visit(ossimObject* obj);
void setTypeName(const ossimString& typeName);
const ossimString& getTypeName()const;
/**
* @brief Set the m_firstOfTypeFlag.
*
* @param flag If flag is true, ossimTypeNameVisitor::visit will stop traversing if it
* finds an object of m_typeName.
*/
void setFirstOfTypeFlag(bool flag);
/** @return m_firstOfTypeFlag */
bool getFirstOfTypeFlag() const;
protected:
ossimString m_typeName;
bool m_firstOfTypeFlag;
};
class OSSIM_DLL ossimTypeIdVisitor : public ossimCollectionVisitor
{
public:
ossimTypeIdVisitor(int visitorType =(VISIT_INPUTS|VISIT_CHILDREN));
ossimTypeIdVisitor(const RTTItypeid& typeId, bool firstofTypeFlag=false, int visitorType =(VISIT_INPUTS|VISIT_CHILDREN));
ossimTypeIdVisitor(const ossimTypeIdVisitor& src);
virtual ossimRefPtr<ossimVisitor> dup()const;
virtual void visit(ossimObject* obj);
void setTypeId(const RTTItypeid& typeId);
const RTTItypeid& getTypeId()const;
protected:
RTTItypeid m_typeId;
bool m_firstOfTypeFlag;
};
class OSSIM_DLL ossimEventVisitor : public ossimVisitor
{
public:
ossimEventVisitor(ossimEvent* evt,
int visitorType =(VISIT_OUTPUTS|VISIT_CHILDREN));
ossimEventVisitor(const ossimEventVisitor& src);
virtual ossimRefPtr<ossimVisitor> dup()const;
virtual void visit(ossimObject* obj);
protected:
ossimRefPtr<ossimEvent> m_event;
};
/**
* @class ossimViewInterfaceVisitor
*
* Visitor to update view and then propagate property event to outputs.
*/
class OSSIM_DLL ossimViewInterfaceVisitor : public ossimVisitor
{
public:
ossimViewInterfaceVisitor(ossimObject* view,
int visitorType =(VISIT_OUTPUTS|VISIT_CHILDREN));
ossimViewInterfaceVisitor(const ossimViewInterfaceVisitor& src);
virtual ossimRefPtr<ossimVisitor> dup()const;
/**
* @brief Calls ossimViewInterface::setView if obj cast to
* ossimViewInterface*. On success a property event is sent to
* output side so that things like ossimCombiner can reinitialize if
* needed.
*
* @param obj Object to visit.
*/
virtual void visit(ossimObject* obj);
ossimObject* getView();
const ossimObject* getView()const;
protected:
ossimRefPtr<ossimObject> m_view;
};
/**
* @class ossimSourceInitializeVisitor
*
* Visitor to update view and then propagate property event to outputs.
*/
class OSSIM_DLL ossimSourceInitializeVisitor : public ossimVisitor
{
public:
ossimSourceInitializeVisitor(int visitorType = VISIT_OUTPUTS);
ossimSourceInitializeVisitor(const ossimSourceInitializeVisitor& src);
virtual ossimRefPtr<ossimVisitor> dup()const;
/**
* @brief Calls ossimViewInterface::setView if obj cast to
* ossimViewInterface*. On success a property event is sent to
* output side so that things like ossimCombiner can reinitialize if
* needed.
*
* @param obj Object to visit.
*/
virtual void visit(ossimObject* obj);
};
#endif
|