00001 // Filename: factoryParams.h 00002 // Created by: drose (08May00) 00003 // 00004 //////////////////////////////////////////////////////////////////// 00005 // 00006 // PANDA 3D SOFTWARE 00007 // Copyright (c) 2001, Disney Enterprises, Inc. All rights reserved 00008 // 00009 // All use of this software is subject to the terms of the Panda 3d 00010 // Software license. You should have received a copy of this license 00011 // along with this source code; you will also find a current copy of 00012 // the license at http://www.panda3d.org/license.txt . 00013 // 00014 // To contact the maintainers of this program write to 00015 // panda3d@yahoogroups.com . 00016 // 00017 //////////////////////////////////////////////////////////////////// 00018 00019 #ifndef FACTORYPARAMS_H 00020 #define FACTORYPARAMS_H 00021 00022 #include <pandabase.h> 00023 00024 #include "typedObject.h" 00025 #include "typedReferenceCount.h" 00026 #include "pointerTo.h" 00027 #include "factoryParam.h" 00028 #include "dcast.h" 00029 00030 #include "pvector.h" 00031 00032 //////////////////////////////////////////////////////////////////// 00033 // Class : FactoryParams 00034 // Description : An instance of this class is passed to the Factory 00035 // when requesting it to do its business and construct a 00036 // new something. It can be filled with optional 00037 // parameters to the CreateFunc for the particular 00038 // subclass the Factory will be creating. 00039 // 00040 // This is just a vector of pointers to *something*; it 00041 // will be up to the individual CreateFuncs to interpret 00042 // this meaningfully. 00043 //////////////////////////////////////////////////////////////////// 00044 class EXPCL_PANDA FactoryParams { 00045 public: 00046 FactoryParams(); 00047 ~FactoryParams(); 00048 00049 void add_param(FactoryParam *param); 00050 void clear(); 00051 00052 int get_num_params() const; 00053 FactoryParam *get_param(int n) const; 00054 00055 FactoryParam *get_param_of_type(TypeHandle type) const; 00056 00057 private: 00058 typedef pvector< PT(TypedReferenceCount) > Params; 00059 00060 Params _params; 00061 }; 00062 00063 template<class ParamType> 00064 INLINE bool get_param_into(ParamType *&pointer, const FactoryParams ¶ms); 00065 00066 #include "factoryParams.I" 00067 00068 #endif