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