File indexing completed on 2025-01-18 09:14:58
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013 #ifndef EXAMPLES_PERSISTENCY_SRC_PERSISTENCYSETUP_H
0014 #define EXAMPLES_PERSISTENCY_SRC_PERSISTENCYSETUP_H
0015
0016 #include "DD4hep/Detector.h"
0017 #include "DD4hep/Printout.h"
0018 #include "DD4hep/Primitives.h"
0019 #include "DD4hep/Conditions.h"
0020 #include "DD4hep/Alignments.h"
0021 #include "DD4hep/Grammar.h"
0022 #include "DD4hep/AlignmentData.h"
0023 #include "DD4hep/detail/AlignmentsInterna.h"
0024 #include "DD4hep/detail/ConditionsInterna.h"
0025
0026
0027 namespace dd4hep {
0028
0029
0030 namespace PersistencyExamples {
0031
0032 template<typename T> Condition make_condition(const std::string& name, T val) {
0033 Condition cond("Test#"+name, name);
0034 T& value = cond.bind<T>();
0035 value = val;
0036 cond->hash = ConditionKey(detail::hash32("TestCondition"),name).hash;
0037 return cond;
0038 }
0039
0040
0041 int printCondition(Condition cond);
0042
0043 class PersistencyIO {
0044 public:
0045
0046 PersistencyIO();
0047
0048 virtual ~PersistencyIO();
0049
0050 int write(const std::string& fname, const std::string& title, const std::type_info& typ, const void* object);
0051
0052 template <typename T> int write(const std::string& fname, const std::string& title, const T& object)
0053 {
0054 return write(fname, title, typeid(T), &object);
0055 }
0056
0057 };
0058
0059 }
0060 }
0061
0062 #endif