Skip to content

Commit

Permalink
* Pushed comment changes for missing variables in doxygen generation
Browse files Browse the repository at this point in the history
* Changed Threader to use more references and less full pass by value in strings and knowledge bases
  • Loading branch information
jredmondson committed Dec 23, 2023
1 parent 6a3edc3 commit eb136a2
Show file tree
Hide file tree
Showing 15 changed files with 64 additions and 58 deletions.
2 changes: 1 addition & 1 deletion .readthedocs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ sphinx:

# Optionally build your docs in additional formats such as PDF and ePub
formats:
- pdf
# - pdf
# - epub

# Optional but recommended, declare the Python requirements required
Expand Down
1 change: 1 addition & 0 deletions include/madara/filters/DynamicPrefixPrint.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ class DynamicPrefixPrint : public AggregateFilter
/**
* Prints records and transport context information
* @param records the aggregate records vector
* @param transport_context the transport context where metadata is stored
* @param vars context for querying current program state
**/
inline virtual void filter(knowledge::KnowledgeMap& records,
Expand Down
1 change: 0 additions & 1 deletion include/madara/filters/PrefixIntConvert.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ class PrefixIntConvert : public AggregateFilter
/**
* Converts the records into integer values
* @param records the aggregate records vector
* @param vars context for querying current program state
**/
inline virtual void filter(knowledge::KnowledgeMap& records,
const transport::TransportContext&, knowledge::Variables&)
Expand Down
1 change: 1 addition & 0 deletions include/madara/filters/PrefixPrint.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ class PrefixPrint : public AggregateFilter
public:
/**
* Constructor
* @param print_verbose if true, print more verbose information
* @param source_prefixes the static prefixes to use for printing. If
* empty, print all variables. If contains prefixes, only print
* variables that begin with contained prefixes
Expand Down
1 change: 1 addition & 0 deletions include/madara/knowledge/CheckpointSettings.h
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ class CheckpointSettings
* @param t_reset_checkpoint reset the checkpoint modifieds
* @param t_ignore_header_check if true, ignore header checks
* @param t_max_buffer_size the max size in bytes for buffer growth
* @param t_variables_lister a custom list of variables to print
**/
CheckpointSettings(size_t t_buffer_size, bool t_clear_knowledge,
std::string t_filename = "", uint64_t t_initial_timestamp = 0,
Expand Down
2 changes: 1 addition & 1 deletion include/madara/knowledge/GetRecord.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ namespace knowledge
* @brief Check if a KnowledgeRecord type matches a specified type
*
* @param t an instance of the type helper struct to infer the target type
* @param in the KnowledgeRecord to read from
* @param kr the KnowledgeRecord to read from
* @return true if the types match
*/
template<typename T>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ class NativeCircularBufferConsumer
* Constructor
* @param name name of the integer in the knowledge base
* @param knowledge the knowledge base that will contain the vector
* @param settings settings for evaluating the vector
* @throw exceptions::NameException bad name ("")
**/
NativeCircularBufferConsumer(
Expand All @@ -66,8 +65,7 @@ class NativeCircularBufferConsumer
/**
* Constructor
* @param name the name of the map within the variable context
* @param knowledge the variable context
* @param settings settings to apply by default
* @param knowledge the variable contex
* @throw exceptions::NameException bad name ("")
**/
NativeCircularBufferConsumer(const std::string& name, Variables& knowledge);
Expand All @@ -85,24 +83,24 @@ class NativeCircularBufferConsumer

/**
* Sets the variable name that this refers to
* @param name the name of the variable in the knowledge base
* @param name the name of the variable in the knowledge base
* @param knowledge the knowledge base the variable is housed in
* @throw exceptions::NameException bad name ("")
**/
void set_name(const std::string& name, KnowledgeBase& knowledge);

/**
* Sets the variable name that this refers to
* @param name the name of the variable in the knowledge base
* @param name the name of the variable in the knowledge base
* @param knowledge the knowledge base the variable is housed in
* @throw exceptions::NameException bad name ("")
**/
void set_name(const std::string& name, Variables& knowledge);

/**
* Sets the variable name that this refers to
* @param name the name of the variable in the knowledge base
* @param knowledge the ThreadSafeContext the variable is housed in
* @param name the name of the variable in the knowledge base
* @param context the ThreadSafeContext the variable is housed in
* @throw exceptions::NameException bad name ("")
**/
void set_name(const std::string& name, ThreadSafeContext& context);
Expand Down
14 changes: 7 additions & 7 deletions include/madara/logger/Logger.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
* uses compiler optimizations to ensure that args are not
* evaluated unless the level is appropriate for the loggers level.
* This makes logging transparent and minimally invasive, performance wise
* @param logger the logger instance to use
* @param level the logging level
* @param loggering the logger instance to use
* @param level the logging level
**/
#define madara_logger_log(loggering, level, ...) \
if (madara::logger::Logger::get_thread_level() >= 0) \
Expand All @@ -35,8 +35,8 @@
* This macro uses compiler optimizations to ensure that args are not
* evaluated unless the level is appropriate for the loggers level.
* This makes logging transparent and minimally invasive, performance wise
* @param logger the logger pointer to use
* @param level the logging level
* @param loggering the logger to use
* @param level the logging level
**/
#define madara_logger_ptr_log(loggering, level, ...) \
if (madara::logger::Logger::get_thread_level() >= 0) \
Expand All @@ -56,8 +56,8 @@
* This macro uses compiler optimizations to ensure that args are not
* evaluated unless the level is appropriate for the loggers level.
* This makes logging transparent and minimally invasive, performance wise
* @param logger the logger pointer to use
* @param level the logging level
* @param loggering the logger pointer to use
* @param level the logging level
**/
#define madara_logger_checked_ptr_log(loggering, level, ...) \
if (loggering && madara::logger::Logger::get_thread_level() >= 0) \
Expand Down Expand Up @@ -106,7 +106,7 @@
/**
* High-performance logger that performs conditional logging based on first arg
* @param conditional the primary logger pointer to use (if not null)
* @param logger the logger that will be used if conditional is true
* @param loggering the logger that will be used if conditional is true
* @param alt_logger_ptr the secondary logger pointer to use (should be
* not null)
* @param level the logging level
Expand Down
22 changes: 11 additions & 11 deletions include/madara/threads/Threader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

madara::threads::Threader::Threader() {}

madara::threads::Threader::Threader(knowledge::KnowledgeBase data_plane)
madara::threads::Threader::Threader(knowledge::KnowledgeBase& data_plane)
: data_(std::move(data_plane))
{
}
Expand All @@ -21,7 +21,7 @@ madara::threads::Threader::~Threader()
wait();
}

void madara::threads::Threader::pause(const std::string name)
void madara::threads::Threader::pause(const std::string& name)
{
NamedWorkerThreads::iterator found = threads_.find(name);

Expand All @@ -40,7 +40,7 @@ void madara::threads::Threader::pause(void)
}
}

void madara::threads::Threader::resume(const std::string name)
void madara::threads::Threader::resume(const std::string& name)
{
NamedWorkerThreads::iterator found = threads_.find(name);

Expand All @@ -60,7 +60,7 @@ void madara::threads::Threader::resume(void)
}

void madara::threads::Threader::run(
const std::string name, BaseThread* thread, bool paused)
const std::string& name, BaseThread* thread, bool paused)
{
if (name != "" && thread != 0)
{
Expand Down Expand Up @@ -98,7 +98,7 @@ void madara::threads::Threader::run(
#ifdef _MADARA_JAVA_

void madara::threads::Threader::run(
const std::string name, jobject thread, bool paused)
const std::string& name, jobject thread, bool paused)
{
if (name != "" && thread != 0)
{
Expand All @@ -114,7 +114,7 @@ void madara::threads::Threader::run(
}

void madara::threads::Threader::run(
double hertz, const std::string name, jobject thread, bool paused)
double hertz, const std::string& name, jobject thread, bool paused)
{
if (name != "" && thread != 0)
{
Expand All @@ -130,7 +130,7 @@ void madara::threads::Threader::run(
#endif // _MADARA_JAVA_

void madara::threads::Threader::run(
double hertz, const std::string name, BaseThread* thread, bool paused)
double hertz, const std::string& name, BaseThread* thread, bool paused)
{
if (name != "" && thread != 0)
{
Expand Down Expand Up @@ -166,12 +166,12 @@ void madara::threads::Threader::run(
}

void madara::threads::Threader::set_data_plane(
knowledge::KnowledgeBase data_plane)
knowledge::KnowledgeBase& data_plane)
{
data_ = std::move(data_plane);
}

void madara::threads::Threader::terminate(const std::string name)
void madara::threads::Threader::terminate(const std::string& name)
{
NamedWorkerThreads::iterator found = threads_.find(name);

Expand All @@ -192,7 +192,7 @@ void madara::threads::Threader::terminate(void)
}

bool madara::threads::Threader::wait(
const std::string name, const knowledge::WaitSettings& ws)
const std::string& name, const knowledge::WaitSettings& ws)
{
bool result(false);

Expand Down Expand Up @@ -253,7 +253,7 @@ bool madara::threads::Threader::wait(const knowledge::WaitSettings& ws)
}

bool madara::threads::Threader::wait_for_paused(
const std::string name, const knowledge::WaitSettings& ws)
const std::string& name, const knowledge::WaitSettings& ws)
{
bool result(false);

Expand Down
32 changes: 15 additions & 17 deletions include/madara/threads/Threader.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class MADARA_EXPORT Threader
* Constructor
* @param data_plane The data plane for threads to use
**/
Threader(knowledge::KnowledgeBase data_plane);
Threader(knowledge::KnowledgeBase& data_plane);

/**
* Destructor
Expand All @@ -66,7 +66,7 @@ class MADARA_EXPORT Threader
* @param name unique thread name for the thread
* @param hertz new hertz rate for the periodic thread
**/
void change_hertz(const std::string name, double hertz);
void change_hertz(const std::string& name, double hertz);

/**
* Gets the control plane used by threads
Expand All @@ -84,7 +84,7 @@ class MADARA_EXPORT Threader
* Requests a specific thread to pause
* @param name unique thread name for the thread.
**/
void pause(const std::string name);
void pause(const std::string& name);

/**
* Requests all threads to pause
Expand All @@ -95,7 +95,7 @@ class MADARA_EXPORT Threader
* Requests a specific thread to resume (unpause)
* @param name unique thread name for the thread.
**/
void resume(const std::string name);
void resume(const std::string& name);

/**
* Requests all threads to resume (unpause)
Expand All @@ -117,7 +117,7 @@ class MADARA_EXPORT Threader
* @param paused create thread in a paused state.
* @throw exceptions::ThreadException bad name (null)
**/
void run(const std::string name, BaseThread* thread, bool paused = false);
void run(const std::string& name, BaseThread* thread, bool paused = false);

/**
* Starts a new thread and executes the provided user
Expand All @@ -139,7 +139,7 @@ class MADARA_EXPORT Threader
* @param paused create thread in a paused state.
* @throw exceptions::ThreadException bad name (null)
**/
void run(double hertz, const std::string name, BaseThread* thread,
void run(double hertz, const std::string& name, BaseThread* thread,
bool paused = false);

#ifdef _MADARA_JAVA_
Expand All @@ -158,7 +158,7 @@ class MADARA_EXPORT Threader
* @param thread user-created thread implementation
* @param paused create thread in a paused state.
**/
void run(const std::string name, jobject thread, bool paused = false);
void run(const std::string& name, jobject thread, bool paused = false);

/**
* Starts a new thread and executes the provided user
Expand All @@ -179,7 +179,7 @@ class MADARA_EXPORT Threader
* @param thread user-created thread implementation
* @param paused create thread in a paused state.
**/
void run(double hertz, const std::string name, jobject thread,
void run(double hertz, const std::string& name, jobject thread,
bool paused = false);

#endif
Expand All @@ -188,13 +188,13 @@ class MADARA_EXPORT Threader
* Sets the data plane for new threads
* @param data_plane The data plane for threads to use
**/
void set_data_plane(knowledge::KnowledgeBase data_plane);
void set_data_plane(knowledge::KnowledgeBase& data_plane);

/**
* Requests a specific thread to terminate
* @param name unique thread name for the thread.
**/
void terminate(const std::string name);
void terminate(const std::string& name);

/**
* Requests all debugging for threads go into the data plane
Expand All @@ -203,21 +203,20 @@ class MADARA_EXPORT Threader
* if possible.
* @param prefix prefix to save debug info into data plane KB
**/
void debug_to_kb(const std::string prefix = ".threader");
void debug_to_kb(const std::string& prefix = ".threader");

/**
* Requests a specific thread to disable debug mode. Debug mode
* prints thread performance information such as durations
* and executions.
* @param name unique thread name for the thread.
**/
void disable_debug(const std::string name);
void disable_debug(const std::string& name);

/**
* Requests that all new threads disable debug mode. Debug mode
* prints thread performance information such as durations
* and executions. Disabled is the default mode.
* @param name unique thread name for the thread.
**/
void disable_debug(void);

Expand All @@ -227,13 +226,12 @@ class MADARA_EXPORT Threader
* and executions.
* @param name unique thread name for the thread.
**/
void enable_debug(const std::string name);
void enable_debug(const std::string& name);

/**
* Requests that all new threads to enter debug mode. Debug mode
* prints thread performance information such as durations
* and executions. Disabled is the default mode.
* @param name unique thread name for the thread.
**/
void enable_debug(void);

Expand All @@ -248,7 +246,7 @@ class MADARA_EXPORT Threader
* @param ws wait settings for specifying period and timeout
* @return true if thread was terminated, false if timeout
**/
bool wait(const std::string name,
bool wait(const std::string& name,
const knowledge::WaitSettings& ws = knowledge::WaitSettings());

/**
Expand All @@ -264,7 +262,7 @@ class MADARA_EXPORT Threader
* @param ws wait settings for specifying period and timeout
* @return true if thread was terminated, false if timeout
**/
bool wait_for_paused(const std::string name,
bool wait_for_paused(const std::string& name,
const knowledge::WaitSettings& ws = knowledge::WaitSettings());

/**
Expand Down

0 comments on commit eb136a2

Please sign in to comment.