C++ guide¶
uLib is a layered C++17 framework. Its public headers are the source of truth:
each library installs the headers listed by its CMakeLists.txt, and
the catalogue in this section indexes their public uLib types.
| Need | Start here |
|---|---|
| Object ownership, properties, algorithms, persistence, byte I/O | Core and uprops |
| Transforms, grids, images, meshes, statistics, filters | Math |
| Muon reconstruction and Geant4 scene objects | HEP and Geant |
| Render wrappers, viewport, and ROOT persistence/plots | VTK and ROOT |
Pull streams, queues, DataBuffer, and producer/consumer chains |
Streaming and contexts |
| Every installed uLib class and header family | Complete class catalog |
| Adding a library, class, and its documentation | Plugin API documentation |
Link the libraries¶
The default library prefix is mutom; a configured build therefore
exports targets such as mutomCore and mutomMath.
The package prefix is configurable, so inspect the installed
uLibTargets.cmake if a downstream installation uses another name.
find_package(uLib CONFIG REQUIRED)
add_executable(example main.cpp)
target_link_libraries(example PRIVATE mutomCore mutomMath)
target_compile_features(example PRIVATE cxx_std_17)
When building inside this repository, link the same targets directly. Geant, VTK, ROOT, and HEP targets are optional: link them only when the matching component was configured.
First scene object¶
The owning ObjectsContext is the normal path for objects that
belong in a scene. It gives them a durable identity, emits lifecycle changes,
and keeps VTK/UI/serialization consumers in sync.
#include "Core/ObjectsContext.h"
#include "Math/ContainerBox.h"
int main() {
uLib::ObjectsContext scene;
auto *absorber = new uLib::ContainerBox();
absorber->SetInstanceName("absorber");
absorber->SetSize(uLib::Vector3f(100.0f, 50.0f, 10.0f));
scene.AddObject(absorber); // scene is the authoritative owner
}
Use the direct constructor only when the object is a temporary value or another owner is explicit. Do not put an object in parallel owning collections; wrappers and views should observe the context that owns it.
The object/property model¶
Every scene object derives from uLib::Object. Registered
properties provide editing, serialization, remote synchronization, and node
ports from one declaration.
#include "Core/Object.h"
#include "Core/Property.h"
class Gain final : public uLib::Object {
public:
ULIB_PROPERTY(double, Value, 1.0)
Gain() {
ULIB_ACTIVATE_PROPERTIES(*this);
Value.SetRange(0.0, 10.0);
}
};
See Core and uprops for property ports, reference ownership, actions, and class-specific serialization. See Streaming and contexts before making a consumer that reads a collection or a live queue.
Scope of the catalog¶
The catalog covers public uLib declarations from the headers installed by
mutomuProps, mutomCore, mutomMath,
mutomDetectors, mutomMuonTomography,
mutomGeant, mutomVtk, and mutomRoot.
Templates are listed by their primary type rather than every possible
instantiation. Forward declarations of third-party classes (VTK, ROOT,
Geant4, Qt, Boost) are deliberately not duplicated as uLib API.