JeVois
1.19
JeVois Smart Embedded Machine Vision Toolkit
|
Share this page: |
|
|
|
 |
 |
|
Go to the documentation of this file.
23 #include <boost/thread.hpp>
27 #include <unordered_map>
247 template <
class Comp,
typename... Args>
248 std::shared_ptr<Comp>
addSubComponent(std::string
const & instance, Args && ...args);
254 template <
class Comp>
267 template <
class Comp = jevois::Component>
268 std::shared_ptr<Comp>
getSubComponent(std::string
const & instance)
const;
340 template <
typename T>
341 std::vector<std::string>
setParamVal(std::string
const & paramdescriptor, T
const & val);
346 template <
typename T>
367 template <
typename T>
368 std::vector<std::pair<std::string, T> >
getParamVal(std::string
const & paramdescriptor)
const;
381 template <
typename T>
390 std::vector<std::string>
setParamString(std::string
const & paramdescriptor, std::string
const & val);
404 std::vector<std::pair<std::string, std::string> >
getParamString(std::string
const & paramdescriptor)
const;
412 void freezeParam(std::string
const & paramdescriptor);
439 virtual void paramInfo(std::shared_ptr<UserInterface> s, std::map<std::string, std::string> & categs,
440 bool skipFrozen, std::string
const & cname =
"", std::string
const & pfx =
"");
444 std::string
const & cname =
"");
452 template <
typename T>
453 std::shared_ptr<DynamicParameter<T>>
454 addDynamicParameter(std::string
const & name, std::string
const & description, T
const & defaultValue,
462 template <
typename T,
template <
typename>
class ValidValuesSpec>
463 std::shared_ptr<DynamicParameter<T>>
464 addDynamicParameter(std::string
const & name, std::string
const & description, T
const & defaultValue,
470 template <
typename T>
472 bool callnow =
true);
488 void setPath(std::string
const & path);
492 std::filesystem::path
absolutePath(std::filesystem::path
const & path =
"");
521 mutable boost::shared_mutex itsMtx;
524 std::vector<std::shared_ptr<Component> > itsSubComponents;
527 mutable boost::shared_mutex itsSubMtx;
530 void populateHelpMessage(std::string
const & cname,
531 std::unordered_map<std::string ,
532 std::unordered_map<std::string ,
533 std::vector<std::pair<std::string /* component */, std::string /* value */ > > > > &
534 helplist,
bool recurse =
true)
const;
544 void setInitialized();
551 virtual void uninit();
557 void setUninitialized();
560 void runPostUninit();
563 mutable boost::shared_mutex itsMetaMtx;
564 std::string
const itsClassName;
565 std::string itsInstanceName;
568 volatile bool itsInitialized;
574 void findParamAndActOnIt(std::string
const &
descriptor,
576 std::function<
bool()> empty)
const;
577 void findParamAndActOnIt(std::vector<std::string>
const & descrip,
bool recur,
size_t idx,
578 std::string
const & unrolled,
588 std::string computeInstanceName(std::string
const & instance, std::string
const & classname =
"")
const;
594 void doRemoveSubComponent(std::vector<std::shared_ptr<Component> >::iterator & itr,
595 boost::upgrade_lock<boost::shared_mutex> & uplck,
596 std::string
const & displayname);
599 std::map<std::string , std::shared_ptr<ParameterBase>> itsDynParams;
600 mutable std::mutex itsDynParMtx;
622 #include <jevois/Component/details/ComponentImpl.H>
std::istream & setParamsFromStream(std::istream &is, std::string const &absfile)
Set some parameters from an open stream.
std::string descriptor() const
Get our full descriptor (including all parents) as [Instancename]:[...]:[...].
const std::string & instanceName() const
The instance name of this component.
Data collection mode RAW means that the latest available raw data is returned each time get() is called
void freezeParam(std::string const ¶mdescriptor)
Freeze a parameter, by name, see ParameterBase::freeze()
friend class Component
Allow Component and DynamicParameter to access our registry data, everyone else is locked out.
#define NEW_NORM_TENSOR(_id, _attr, _dtype)
Manager of a hierarchy of Component objects.
bool isTopLevel() const
Returns true if this component is top-level, i.e., its parent is jevois::Manager.
std::vector< std::string > split(std::string const &input, std::string const ®ex="\\s+")
Split string into vector of tokens using a regex to specify what to split on; default regex splits by...
Send serial message to mark the the end(MARK STOP)
A component of a model hierarchy.
void unFreezeParam(std::string const ¶mdescriptor)
Unfreeze a parameter, by name, see ParameterBase::unFreeze()
std::shared_ptr< DynamicParameter< T > > addDynamicParameter(std::string const &name, std::string const &description, T const &defaultValue, ParameterCategory const &category)
Add a new parameter after the Component has already been constructed.
std::shared_ptr< Comp > getSubComponent(std::string const &instance) const
Get a sub-component by instance name.
void setDynamicParameterCallback(std::string const &name, std::function< void(T const &)> cb, bool callnow=true)
Register a callback with a previously created dynamic parameter.
void foreachParam(std::function< void(std::string const &compname, ParameterBase *p)> func, std::string const &cname="")
Run a function on every param we hold.
Base class for Parameter.
std::string getParamStringUnique(std::string const ¶mdescriptor) const
Get a parameter value by string, simple version assuming only one parameter match.
void removeSubComponent(std::shared_ptr< Comp > &component)
Remove a sub-Component from this Component, by shared_ptr.
void removeDynamicParameter(std::string const &name)
Remove a previously added dynamic parameter.
A category to which multiple ParameterDef definitions can belong.
std::shared_ptr< Comp > addSubComponent(std::string const &instance, Args &&...args)
Pseudo-constructor: construct and add another component as a subcomponent of this one.
void setPath(std::string const &path)
Assign a filesystem path to this component.
Data collection mode RAW means that the latest available raw data is returned each time hence timing may not be very accurate depending on how regularly grate into a FIFO and and accumulates resulting output data into the IMU s internal FIFO buffer at a fixed rate This parameter can only be set in a module s params cfg file
std::vector< std::pair< std::string, T > > getParamVal(std::string const ¶mdescriptor) const
Get parameter(s) value(s) by descriptor.
void setParamsFromFile(std::string const &filename)
Set some parameters from a file.
const std::string & className() const
The class name of this component.
T getParamValUnique(std::string const ¶mdescriptor) const
Get a parameter value, simple version assuming only one parameter match.
virtual void preUninit()
Called before all sub-Components are uninit()ed.
std::vector< std::string > setParamVal(std::string const ¶mdescriptor, T const &val)
Set a parameter value.
virtual void paramInfo(std::shared_ptr< UserInterface > s, std::map< std::string, std::string > &categs, bool skipFrozen, std::string const &cname="", std::string const &pfx="")
Get machine-oriented descriptions of all parameters.
A simple registry of all parameters associated with a Component.
void setParamValUnique(std::string const ¶mdescriptor, T const &val)
Set a parameter value, simple version assuming only one parameter match.
JeVois processing engine - gets images from camera sensor, processes them, and sends results over USB...
virtual void preInit()
Called before all sub-Components are init()ed.
void unFreezeAllParams()
Unfreeze all parameters.
Virtual base class for a vision processing module.
void freezeAllParams()
Freeze all parameters.
A changeable parameter for a Component, core class.
virtual ~Component()
Virtual destructor for safe inheritance.
virtual void postUninit()
Called after all sub-Components are uninit()ed.
Engine * engine() const
Get a handle to our Engine, or throw if we do not have an Engine as root ancestor.
std::filesystem::path absolutePath(std::filesystem::path const &path="")
If given path is relative (not starting with /), prepend the Component path to it.
virtual void postInit()
Called after all sub-Components are init()ed.
bool initialized() const
Has this component been initialized yet?
std::vector< std::string > setParamString(std::string const ¶mdescriptor, std::string const &val)
Set a parameter value, by string.
void setParamStringUnique(std::string const ¶mdescriptor, std::string const &val)
Set a parameter value by string, simple version assuming only one parameter match.
std::vector< std::pair< std::string, std::string > > getParamString(std::string const ¶mdescriptor) const
Get a parameter value, by string.