00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef OST_IO_IO_PROFILE_HH
00020 #define OST_IO_IO_PROFILE_HH
00021
00022 #include <iostream>
00023 #include <map>
00024 #include <ost/mol/entity_handle.hh>
00025 #include <ost/io/module_config.hh>
00026 #include <ost/conop/processor.hh>
00027
00028 namespace ost { namespace io {
00029
00030
00031 struct DLLEXPORT IOProfile {
00032 public:
00033 IOProfile(String d, bool qm, bool ft, bool js, bool nh,
00034 bool co, conop::ProcessorPtr proc=conop::ProcessorPtr()):
00035 dialect(d), quack_mode(qm), fault_tolerant(ft), join_spread_atom_records(js),
00036 no_hetatms(nh), calpha_only(co), processor(proc)
00037 {
00038 }
00039
00040 IOProfile(): dialect("PDB"), quack_mode(false), fault_tolerant(false),
00041 join_spread_atom_records(false), no_hetatms(false),
00042 calpha_only(false), processor()
00043 { }
00044
00045 String dialect;
00046 bool quack_mode;
00047 bool fault_tolerant;
00048 bool join_spread_atom_records;
00049 bool no_hetatms;
00050 bool calpha_only;
00051 conop::ProcessorPtr processor;
00052 IOProfile Copy()
00053 {
00054 return IOProfile(dialect, quack_mode, fault_tolerant, join_spread_atom_records,
00055 no_hetatms, calpha_only,
00056 processor ? processor->Copy() : conop::ProcessorPtr());
00057 }
00058 };
00059
00060
00061 inline std::ostream& operator<<(std::ostream& stream, const IOProfile& p)
00062 {
00063 stream << "IOProfile(dialect='" << p.dialect
00064 << "', quack_mode=" << (p.quack_mode ? "True" : "False") << ", "
00065 << "join_spread_atom_records=" << (p.join_spread_atom_records ? "True" : "False") << ", "
00066 << "calpha_only=" << (p.calpha_only ? "True" : "False") << ", "
00067 << "fault_tolerant=" << (p.fault_tolerant ? "True" : "False") << ", "
00068 << "no_hetatms=" << (p.no_hetatms ? "True" : "False") << ", "
00069 << "processor=" << (p.processor ? p.processor->ToString() : "None") << ")";
00070 return stream;
00071 }
00072
00073 class DLLEXPORT_OST_IO IOProfileRegistry {
00074 public:
00075 static IOProfileRegistry& Instance();
00076
00077 IOProfile& Get(const String& key)
00078 {
00079 return profiles_[key];
00080 }
00081
00082 void Set(const String& key, const IOProfile& profile)
00083 {
00084 profiles_[key]=profile;
00085 }
00086
00087 IOProfile& GetDefault() { return profiles_["DEFAULT"]; }
00088 static void RemoveProfiles() {
00089 if (IOProfileRegistry::alive) {
00090 IOProfileRegistry::Instance().profiles_.clear();
00091 }
00092 }
00093 ~IOProfileRegistry() {
00094 alive = false;
00095 }
00096 private:
00097 IOProfileRegistry();
00098 std::map<String, IOProfile> profiles_;
00099 static bool alive;
00100 };
00101
00102 }}
00103
00104 #endif