1 //******************************************************************* 2 // Copyright (C) 2000 ImageLinks Inc. 3 // 4 // License: See top level LICENSE.txt file. 5 // 6 // Author: Garrett Potts 7 // 8 // Description: A brief description of the contents of the file. 9 // 10 //************************************************************************* 11 // $Id: ossimConnectableContainerInterface.h 15766 2009-10-20 12:37:09Z gpotts $ 12 #ifndef ossimConnectableContainerInterface_HEADER 13 #define ossimConnectableContainerInterface_HEADER 14 15 #include <ossim/base/ossimConstants.h> 16 #include <ossim/base/ossimRtti.h> 17 #include <ossim/base/ossimId.h> 18 #include <ossim/base/ossimConnectableObject.h> 19 #include <vector> 20 21 class ossimString; 22 23 class OSSIMDLLEXPORT ossimConnectableContainerInterface 24 { 25 public: ossimConnectableContainerInterface(ossimObject * obj)26 ossimConnectableContainerInterface(ossimObject* obj):theBaseObject(obj){} ~ossimConnectableContainerInterface()27 virtual ~ossimConnectableContainerInterface(){theBaseObject=NULL;} 28 29 /*! 30 * Will find all objects of the past in type. Use the RTTI type info. An optional 31 * recurse flag will say if there is another container then recurse it to 32 * find the type you are looking for else it just looks within its immediate 33 * children 34 * 35 * Example: passing STATIC_TYPE_INFO(ossimImageRenderer) as an argument will 36 * look for all ossimImageRenderer's and return the list. 37 */ 38 virtual ossimConnectableObject::ConnectableObjectList findAllObjectsOfType(const RTTItypeid& typeInfo, 39 bool recurse=true)=0; 40 virtual ossimConnectableObject::ConnectableObjectList findAllObjectsOfType(const ossimString& className, 41 bool recurse=true)=0; 42 43 /*! 44 * Will find the firt object of the past in type. Use the RTTI type info.An optional 45 * recurse flag will say if there is another container then recurse it to 46 * find the type you are looking for else it just looks within its immediate 47 * children 48 * 49 * Example: passing STATIC_TYPE_INFO(ossimImageRenderer) as an argument will 50 * look for the first ossimImageRenderer and return that object. 51 */ 52 virtual ossimConnectableObject* findFirstObjectOfType(const RTTItypeid& typeInfo, 53 bool recurse=true)=0; 54 55 virtual ossimConnectableObject* findFirstObjectOfType(const ossimString& className, 56 bool recurse=true)=0; 57 58 /*! 59 * will search for the object given an id. If recurse is true it will recurse 60 * to other containers. 61 */ 62 virtual ossimConnectableObject* findObject(const ossimId& id, 63 bool recurse=true)=0; 64 65 virtual ossimConnectableObject* findObject(const ossimConnectableObject* obj, 66 bool recurse=true)=0; 67 /*! 68 * Will cycle through all sources setting their ids. the idLast wlil be updated 69 * so we can recurse into other containers. 70 */ 71 virtual void makeUniqueIds()=0; 72 73 /*! 74 * Returns the number of objects within this container and all child containers. 75 */ 76 virtual ossim_uint32 getNumberOfObjects(bool recurse=true)const=0; 77 78 79 /*! 80 * Will add an object to the container and then set the added objects owner 81 * to this. 82 */ 83 virtual bool addChild(ossimConnectableObject* attachableObject)=0; 84 85 /*! 86 * Will remove the child from the container. Changes the owner of the 87 * child to be NULL; 88 */ 89 virtual bool removeChild(ossimConnectableObject* object)=0; 90 91 /*! 92 * Gives access to the this point of the base object that everyone derives 93 * from. 94 */ getObject()95 ossimObject* getObject(){return theBaseObject;} getObject()96 const ossimObject* getObject()const{return theBaseObject;} 97 98 /** 99 * @param index Index of object to get. 100 * 101 * @see getNumberOfObjects(false) to get the number of objects inside 102 * the container. 103 * 104 * @return Container's object at that index or NULL if out of range. 105 * 106 * @note This does not recurse into other containers. 107 */ 108 virtual ossimConnectableObject* getConnectableObject(ossim_uint32 index)=0; 109 110 void deleteAllChildren(); 111 virtual void getChildren(std::vector<ossimConnectableObject*>& children, 112 bool immediateChildrenOnlyFlag)=0; 113 protected: 114 ossimObject* theBaseObject; 115 TYPE_DATA 116 }; 117 118 #endif 119