Panda3D
|
00001 // Filename: dcClassParameter.h 00002 // Created by: drose (29Jun04) 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 DCSWITCHPARAMETER_H 00016 #define DCSWITCHPARAMETER_H 00017 00018 #include "dcbase.h" 00019 #include "dcParameter.h" 00020 00021 class DCSwitch; 00022 00023 //////////////////////////////////////////////////////////////////// 00024 // Class : DCSwitchParameter 00025 // Description : This represents a switch object used as a 00026 // parameter itself, which packs the appropriate fields 00027 // of the switch into the message. 00028 //////////////////////////////////////////////////////////////////// 00029 class EXPCL_DIRECT DCSwitchParameter : public DCParameter { 00030 public: 00031 DCSwitchParameter(const DCSwitch *dswitch); 00032 DCSwitchParameter(const DCSwitchParameter ©); 00033 00034 PUBLISHED: 00035 virtual DCSwitchParameter *as_switch_parameter(); 00036 virtual const DCSwitchParameter *as_switch_parameter() const; 00037 virtual DCParameter *make_copy() const; 00038 virtual bool is_valid() const; 00039 00040 const DCSwitch *get_switch() const; 00041 00042 public: 00043 virtual DCPackerInterface *get_nested_field(int n) const; 00044 00045 const DCPackerInterface *apply_switch(const char *value_data, size_t length) const; 00046 00047 virtual void output_instance(ostream &out, bool brief, const string &prename, 00048 const string &name, const string &postname) const; 00049 virtual void write_instance(ostream &out, bool brief, int indent_level, 00050 const string &prename, const string &name, 00051 const string &postname) const; 00052 virtual void generate_hash(HashGenerator &hashgen) const; 00053 virtual bool pack_default_value(DCPackData &pack_data, bool &pack_error) const; 00054 00055 protected: 00056 virtual bool do_check_match(const DCPackerInterface *other) const; 00057 virtual bool do_check_match_switch_parameter(const DCSwitchParameter *other) const; 00058 00059 private: 00060 const DCSwitch *_dswitch; 00061 }; 00062 00063 #endif