MCPcopy Create free account
hub / github.com/URLab-Sim/UnrealRoboticsLab / main

Function main

Scripts/generate_subclasses.py:112–139  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

110"""
111
112def main():
113 for category, info in DATA.items():
114 base = info["Base"]
115 classes = info["Classes"]
116
117 pub_dir = os.path.join(PUBLIC_ROOT, category)
118 priv_dir = os.path.join(PRIVATE_ROOT, category)
119
120 os.makedirs(pub_dir, exist_ok=True)
121 os.makedirs(priv_dir, exist_ok=True)
122
123 for class_name, enum_val in classes.items():
124 # Header
125 h_path = os.path.join(pub_dir, f"{class_name}.h")
126 h_content = HEADER_TEMPLATE.format(Base=base, ClassName=class_name, Enum=enum_val)
127
128 with open(h_path, "w") as f:
129 f.write(h_content)
130 print(f"Created {h_path}")
131
132 # Cpp
133 custom_cpp = CPP_TEMPLATE.replace("{Category}", category) # To handle path insertion
134 cpp_path = os.path.join(priv_dir, f"{class_name}.cpp")
135 cpp_content = custom_cpp.format(Base=base, ClassName=class_name, Enum=enum_val)
136
137 with open(cpp_path, "w") as f:
138 f.write(cpp_content)
139 print(f"Created {cpp_path}")
140
141if __name__ == "__main__":
142 main()

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected