rogue
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Protected Attributes | List of all members
rogue::interfaces::api::Bsp Class Reference

C++ convenience wrapper around a PyRogue node object. More...

#include <Bsp.h>

Public Member Functions

 Bsp (boost::python::object obj)
 Constructs wrapper from existing Python object.
 
 Bsp (std::string modName, std::string rootClass)
 Constructs wrapper by importing module and instantiating root class.
 
 ~Bsp ()
 Destroys wrapper (stops root when wrapper owns root instance).
 
void addVarListener (void(*func)(std::string, std::string), void(*done)())
 Registers variable listener callbacks on wrapped root.
 
std::string getAttribute (std::string attribute)
 Returns string form of named attribute from wrapped object.
 
rogue::interfaces::api::Bsp operator[] (std::string name)
 Returns wrapper for child node using node(name) lookup.
 
std::shared_ptr< rogue::interfaces::api::BspgetNode (std::string name)
 Returns shared wrapper for child node using getNode(name).
 
std::string operator() (std::string arg)
 Executes wrapped command node with string argument.
 
std::string operator() ()
 Executes wrapped command node without argument.
 
std::string execute (std::string arg)
 Executes wrapped command node with string argument.
 
std::string execute ()
 Executes wrapped command node without argument.
 
void set (std::string value)
 Sets wrapped variable value without forcing write transaction.
 
void setWrite (std::string value)
 Sets wrapped variable value and forces write transaction.
 
std::string get ()
 Gets wrapped variable value without forcing read transaction.
 
std::string readGet ()
 Performs read transaction then gets wrapped variable value.
 

Static Public Member Functions

static std::shared_ptr< rogue::interfaces::api::Bspcreate (boost::python::object obj)
 Creates a wrapper from an existing Python object.
 
static std::shared_ptr< rogue::interfaces::api::Bspcreate (std::string modName, std::string rootClass)
 Creates a wrapper by importing module and instantiating root class.
 

Protected Attributes

boost::python::object _obj
 
bool _isRoot
 
std::string _name
 

Detailed Description

C++ convenience wrapper around a PyRogue node object.

Bsp provides a small C++ API that forwards operations to underlying Python PyRogue objects through Boost.Python. It supports:

If constructed as a root wrapper (create(modName, rootClass)), destructor stops the root automatically.

Definition at line 44 of file Bsp.h.

Constructor & Destructor Documentation

◆ Bsp() [1/2]

rogue::interfaces::api::Bsp::Bsp ( boost::python::object  obj)
explicit

Constructs wrapper from existing Python object.

This constructor is a low-level C++ allocation path. Prefer create() when shared ownership or Python exposure is required.

Parameters
objPython object representing a PyRogue node/root.

Definition at line 40 of file Bsp.cpp.

◆ Bsp() [2/2]

rogue::interfaces::api::Bsp::Bsp ( std::string  modName,
std::string  rootClass 
)

Constructs wrapper by importing module and instantiating root class.

This constructor is a low-level C++ allocation path. Prefer create() when shared ownership or Python exposure is required. Initializes Python, imports modName, constructs rootClass, starts it, and waits until the Python root reports running state.

Parameters
modNamePython module name containing root class.
rootClassPython root class name to instantiate.

Definition at line 46 of file Bsp.cpp.

◆ ~Bsp()

rogue::interfaces::api::Bsp::~Bsp ( )

Destroys wrapper (stops root when wrapper owns root instance).

Definition at line 58 of file Bsp.cpp.

Member Function Documentation

◆ addVarListener()

void rogue::interfaces::api::Bsp::addVarListener ( void(*)(std::string, std::string)  func,
void(*)()  done 
)

Registers variable listener callbacks on wrapped root.

Valid only when wrapper owns a root object.

Parameters
funcCallback invoked per variable update.
doneCallback invoked when listener terminates.

Definition at line 64 of file Bsp.cpp.

◆ create() [1/2]

std::shared_ptr< rogue::interfaces::api::Bsp > rogue::interfaces::api::Bsp::create ( boost::python::object  obj)
static

Creates a wrapper from an existing Python object.

Parameter semantics are identical to the constructor; see Bsp(boost::python::object) for wrapping behavior details. This static factory is the preferred construction path when the object is shared across Rogue graph connections or exposed to Python. It returns std::shared_ptr ownership compatible with Rogue pointer typedefs.

Parameters
objPython object representing a PyRogue node/root.
Returns
Shared pointer to created wrapper.

Company : SLAC National Accelerator Laboratory

Description:

C++ API BSP (Board Support Package)

This file is part of the rogue software platform. It is subject to the license terms in the LICENSE.txt file found in the top-level directory of this distribution and at: https://confluence.slac.stanford.edu/display/ppareg/LICENSE.html. No part of the rogue software platform, including this file, may be copied, modified, propagated, or distributed except according to the terms

contained in the LICENSE.txt file.

Definition at line 29 of file Bsp.cpp.

◆ create() [2/2]

std::shared_ptr< rogue::interfaces::api::Bsp > rogue::interfaces::api::Bsp::create ( std::string  modName,
std::string  rootClass 
)
static

Creates a wrapper by importing module and instantiating root class.

Parameter semantics are identical to the constructor; see Bsp(std::string, std::string) for module/root startup behavior details. This static factory is the preferred construction path when the object is shared across Rogue graph connections or exposed to Python. It returns std::shared_ptr ownership compatible with Rogue pointer typedefs.

Parameters
modNamePython module name containing root class.
rootClassPython root class name to instantiate.
Returns
Shared pointer to created wrapper.

Definition at line 35 of file Bsp.cpp.

◆ execute() [1/2]

std::string rogue::interfaces::api::Bsp::execute ( )

Executes wrapped command node without argument.

Execute command without arg.

Returns
Command result string.

Definition at line 139 of file Bsp.cpp.

◆ execute() [2/2]

std::string rogue::interfaces::api::Bsp::execute ( std::string  arg)

Executes wrapped command node with string argument.

Execute command.

Parameters
argCommand argument string.
Returns
Command result string.

Definition at line 130 of file Bsp.cpp.

◆ get()

std::string rogue::interfaces::api::Bsp::get ( )

Gets wrapped variable value without forcing read transaction.

Get value.

Returns
Current value string from Python getDisp.

Definition at line 172 of file Bsp.cpp.

◆ getAttribute()

std::string rogue::interfaces::api::Bsp::getAttribute ( std::string  attribute)

Returns string form of named attribute from wrapped object.

Get Attribute.

Parameters
attributeAttribute name.
Returns
Attribute value string.

Definition at line 74 of file Bsp.cpp.

◆ getNode()

std::shared_ptr< rogue::interfaces::api::Bsp > rogue::interfaces::api::Bsp::getNode ( std::string  name)

Returns shared wrapper for child node using getNode(name).

Return a sub-node.

Parameters
nameChild node path.
Returns
Shared pointer to child-node wrapper.

Definition at line 99 of file Bsp.cpp.

◆ operator()() [1/2]

std::string rogue::interfaces::api::Bsp::operator() ( )

Executes wrapped command node without argument.

Execute command operator without arg.

Returns
Command result string.

Definition at line 121 of file Bsp.cpp.

◆ operator()() [2/2]

std::string rogue::interfaces::api::Bsp::operator() ( std::string  arg)

Executes wrapped command node with string argument.

Execute command operator.

Parameters
argCommand argument string.
Returns
Command result string.

Definition at line 112 of file Bsp.cpp.

◆ operator[]()

rogue::interfaces::api::Bsp rogue::interfaces::api::Bsp::operator[] ( std::string  name)

Returns wrapper for child node using node(name) lookup.

Return a sub-node operator.

Parameters
nameChild node name/path.
Returns
Wrapper for child node.

Definition at line 86 of file Bsp.cpp.

◆ readGet()

std::string rogue::interfaces::api::Bsp::readGet ( )

Performs read transaction then gets wrapped variable value.

Get value with read.

Returns
Read-back value string from Python getDisp.

Definition at line 181 of file Bsp.cpp.

◆ set()

void rogue::interfaces::api::Bsp::set ( std::string  value)

Sets wrapped variable value without forcing write transaction.

Set value.

Parameters
valueValue string passed to Python setDisp.

Definition at line 148 of file Bsp.cpp.

◆ setWrite()

void rogue::interfaces::api::Bsp::setWrite ( std::string  value)

Sets wrapped variable value and forces write transaction.

Set value withe write.

Parameters
valueValue string passed to Python setDisp.

Definition at line 160 of file Bsp.cpp.

Member Data Documentation

◆ _isRoot

bool rogue::interfaces::api::Bsp::_isRoot
protected

Definition at line 47 of file Bsp.h.

◆ _name

std::string rogue::interfaces::api::Bsp::_name
protected

Definition at line 48 of file Bsp.h.

◆ _obj

boost::python::object rogue::interfaces::api::Bsp::_obj
protected

Definition at line 46 of file Bsp.h.


The documentation for this class was generated from the following files: