PBCircuit.h
1/* Distributed under the Apache License, Version 2.0.
2 See accompanying NOTICE file for details.*/
3
4#pragma once
5
6// Forward Declaire SE and Protobuf Circuit Types
7CDM_BIND_DECL2(CircuitManager)
8CDM_BIND_DECL2(ElectricalCircuit)
9CDM_BIND_DECL2(ElectricalCircuitNode)
10CDM_BIND_DECL2(ElectricalCircuitPath)
11CDM_BIND_DECL2(FluidCircuit)
12CDM_BIND_DECL2(FluidCircuitNode)
13CDM_BIND_DECL2(FluidCircuitPath)
14CDM_BIND_DECL2(ThermalCircuit)
15CDM_BIND_DECL2(ThermalCircuitNode)
16CDM_BIND_DECL2(ThermalCircuitPath)
17// Include Templates
18#include "cdm/circuit/SECircuit.h"
19#include "cdm/circuit/SECircuitNode.h"
20#include "cdm/circuit/SECircuitPath.h"
21CDM_BIND_DECL(CircuitData)
22CDM_BIND_DECL(CircuitNodeData)
23CDM_BIND_DECL(CircuitPathData)
24
25class CDM_DECL PBCircuit
26{
27public:
28
29 static bool LoadCircuitManagerFile(SECircuitManager& mgr, const std::string& filename);
30 static void SaveCircuitManagerFile(const SECircuitManager& mgr, const std::string& filename);
31
32 // General Circuit
33 static void Load(const CDM_BIND::CircuitManagerData& src, SECircuitManager& dst);
34 static CDM_BIND::CircuitManagerData* Unload(const SECircuitManager& src);
35
36 template<typename CircuitBindType, CIRCUIT_TEMPLATE>
37 static void Load(const CircuitBindType& src, SECircuit<CIRCUIT_TYPES>& dst, const std::map<std::string, NodeType*>& nodes, const std::map<std::string, PathType*>& paths);
38 template <typename CircuitBindType, CIRCUIT_TEMPLATE>
39 static CircuitBindType* Unload(const SECircuit<CIRCUIT_TYPES>& src);
40
41 static void Serialize(const CDM_BIND::CircuitManagerData& src, SECircuitManager& dst);
42 static void Serialize(const SECircuitManager& src, CDM_BIND::CircuitManagerData& dst);
43
44 template<typename CircuitBindType, CIRCUIT_TEMPLATE>
45 static void Serialize(const CircuitBindType& src, SECircuit<CIRCUIT_TYPES>& dst, const std::map<std::string, NodeType*>& nodes, const std::map<std::string, PathType*>& paths);
46 template<typename CircuitBindType, CIRCUIT_TEMPLATE>
47 static void Serialize(const SECircuit<CIRCUIT_TYPES>& src, CircuitBindType& dst);
48 template<CIRCUIT_NODE_TEMPLATE>
49 static void Serialize(const CDM_BIND::CircuitNodeData& src, SECircuitNode<CIRCUIT_NODE_TYPES>& dst);
50 template<CIRCUIT_NODE_TEMPLATE>
51 static void Serialize(const SECircuitNode<CIRCUIT_NODE_TYPES>& src, CDM_BIND::CircuitNodeData& dst);
52 template<CIRCUIT_PATH_TEMPLATE>
53 static void Serialize(const CDM_BIND::CircuitPathData& src, SECircuitPath<CIRCUIT_PATH_TYPES>& dst);
54 template<CIRCUIT_PATH_TEMPLATE>
55 static void Serialize(const SECircuitPath<CIRCUIT_PATH_TYPES>& src, CDM_BIND::CircuitPathData& dst);
56
57 // Electrical
58 static void Load(const CDM_BIND::ElectricalCircuitPathData& src, SEElectricalCircuitPath& dst);
59 static CDM_BIND::ElectricalCircuitPathData* Unload(const SEElectricalCircuitPath& src);
60 static void Load(const CDM_BIND::ElectricalCircuitNodeData& src, SEElectricalCircuitNode& dst);
61 static CDM_BIND::ElectricalCircuitNodeData* Unload(const SEElectricalCircuitNode& src);
62 static void Serialize(const CDM_BIND::ElectricalCircuitPathData& src, SEElectricalCircuitPath& dst);
63 static void Serialize(const SEElectricalCircuitPath& src, CDM_BIND::ElectricalCircuitPathData& dst);
64 static void Serialize(const CDM_BIND::ElectricalCircuitNodeData& src, SEElectricalCircuitNode& dst);
65 static void Serialize(const SEElectricalCircuitNode& src, CDM_BIND::ElectricalCircuitNodeData& dst);
66
67 // Fluid
68 static void Load(const CDM_BIND::FluidCircuitPathData& src, SEFluidCircuitPath& dst);
69 static CDM_BIND::FluidCircuitPathData* Unload(const SEFluidCircuitPath& src);
70 static void Load(const CDM_BIND::FluidCircuitNodeData& src, SEFluidCircuitNode& dst);
71 static CDM_BIND::FluidCircuitNodeData* Unload(const SEFluidCircuitNode& src);
72 static void Serialize(const CDM_BIND::FluidCircuitPathData& src, SEFluidCircuitPath& dst);
73 static void Serialize(const SEFluidCircuitPath& src, CDM_BIND::FluidCircuitPathData& dst);
74 static void Serialize(const CDM_BIND::FluidCircuitNodeData& src, SEFluidCircuitNode& dst);
75 static void Serialize(const SEFluidCircuitNode& src, CDM_BIND::FluidCircuitNodeData& dst);
76
77 // Thermal
78 static void Load(const CDM_BIND::ThermalCircuitNodeData& src, SEThermalCircuitNode& dst);
79 static CDM_BIND::ThermalCircuitNodeData* Unload(const SEThermalCircuitNode& src);
80 static void Load(const CDM_BIND::ThermalCircuitPathData& src, SEThermalCircuitPath& dst);
81 static CDM_BIND::ThermalCircuitPathData* Unload(const SEThermalCircuitPath& src);
82 static void Serialize(const CDM_BIND::ThermalCircuitNodeData& src, SEThermalCircuitNode& dst);
83 static void Serialize(const SEThermalCircuitNode& src, CDM_BIND::ThermalCircuitNodeData& dst);
84 static void Serialize(const CDM_BIND::ThermalCircuitPathData& src, SEThermalCircuitPath& dst);
85 static void Serialize(const SEThermalCircuitPath& src, CDM_BIND::ThermalCircuitPathData& dst);
86};
Definition: PBCircuit.h:26
static void Serialize(const CDM_BIND::CircuitPathData &src, SECircuitPath< CIRCUIT_PATH_TYPES > &dst)
Definition: SECircuit.h:13
Definition: SECircuitManager.h:38
Definition: SECircuitPath.h:37
Definition: SEElectricalCircuitNode.h:10
Definition: SEElectricalCircuitPath.h:9
Definition: SEFluidCircuitNode.h:10
Definition: SEFluidCircuitPath.h:9
Definition: SEThermalCircuitNode.h:10
Definition: SEThermalCircuitPath.h:9

Distributed under the Apache License, Version 2.0.

See accompanying NOTICE file for details.