Skip to content

Commit

Permalink
* Fixed spacing issues in some generated files
Browse files Browse the repository at this point in the history
  • Loading branch information
jredmondson committed Nov 10, 2018
1 parent 3f43bcc commit 97fdcb6
Show file tree
Hide file tree
Showing 13 changed files with 62 additions and 85 deletions.
37 changes: 7 additions & 30 deletions scripts/projects/common/src/Namespaces.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,50 +9,27 @@
* this file in any project. It is purely for Doxygen documentation.
**/

/**
* @namespace algorithms
* Contains algorithms that can be changed at runtime in GAMS
**/
namespace algorithms
{
}

/**
* @namespace containers
* Contains managed C++ containers that map between C++ variables and knowledge variables
**/
namespace containers
{
}

/**
* @namespace filters
* Contains filters that may shape traffic on-send or on-receive
* Contains filters that can shape traffic on-send or on-receive
**/
namespace filters
{
}

/**
* @namespace platforms
* Contains platform drivers and platform threads
* @namespace threads
* Contains threads that can be used by applications
**/
namespace platforms
namespace threads
{
/**
* @namespace platforms::threads
* Contains threads that will be managed by platform drivers
**/
namespace threads
{
}
}

/**
* @namespace threads
* Contains threads that will be managed by an agent controller
* @namespace transports
* Contains custom transports that can be used for data transfer
**/
namespace threads
namespace transports
{
}

Expand Down
6 changes: 3 additions & 3 deletions scripts/projects/common/src/filter.cpp
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@

#include "MyFilter.h"

filters::MyFilter::MyFilter ()
filters::MyFilter::MyFilter()
{
}

filters::MyFilter::~MyFilter ()
filters::MyFilter::~MyFilter()
{
}

void
filters::MyFilter::filter (
filters::MyFilter::filter(
madara::knowledge::KnowledgeMap & records,
const madara::transport::TransportContext & transport_context,
madara::knowledge::Variables & vars)
Expand Down
6 changes: 3 additions & 3 deletions scripts/projects/common/src/filter.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,20 @@ namespace filters
/**
* Constructor
**/
MyFilter ();
MyFilter();

/**
* Destructor
**/
virtual ~MyFilter ();
virtual ~MyFilter();

/**
* The method that filters incoming or outgoing
* @param records the aggregated packet being evaluated
* @param transport_context context for querying transport state
* @param vars context for querying current program state
**/
virtual void filter (madara::knowledge::KnowledgeMap & records,
virtual void filter(madara::knowledge::KnowledgeMap & records,
const madara::transport::TransportContext & transport_context,
madara::knowledge::Variables & vars);

Expand Down
12 changes: 6 additions & 6 deletions scripts/projects/common/src/thread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
namespace knowledge = madara::knowledge;

// constructor
threads::MyThread::MyThread ()
threads::MyThread::MyThread()
{
}

// destructor
threads::MyThread::~MyThread ()
threads::MyThread::~MyThread()
{
}

Expand All @@ -21,7 +21,7 @@ threads::MyThread::~MyThread ()
* the function.
**/
void
threads::MyThread::init (knowledge::KnowledgeBase & kb)
threads::MyThread::init(knowledge::KnowledgeBase & kb)
{
// point our data plane to the knowledge base initializing the thread
data_ = kb;
Expand All @@ -34,15 +34,15 @@ threads::MyThread::init (knowledge::KnowledgeBase & kb)
* controller.
**/
void
threads::MyThread::run (void)
threads::MyThread::run(void)
{
/**
* the MADARA logger is thread-safe, fast, and allows for specifying
* various options like output files and multiple output targets (
* various options like output files and multiple output targets(
* e.g., std::cerr, a system log, and a thread_output.txt file). You
* can create your own custom log levels or loggers as well.
**/
madara_logger_ptr_log (madara::logger::global_logger.get (),
madara_logger_ptr_log(madara::logger::global_logger.get(),
madara::logger::LOG_MAJOR,
"threads::MyThread::run:"
" executing\n");
Expand Down
8 changes: 4 additions & 4 deletions scripts/projects/common/src/thread.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,23 +17,23 @@ namespace threads
/**
* Default constructor
**/
MyThread ();
MyThread();

/**
* Destructor
**/
virtual ~MyThread ();
virtual ~MyThread();

/**
* Initializes thread with MADARA knowledge base
* @param kb context for querying current program state
**/
virtual void init (madara::knowledge::KnowledgeBase & kb);
virtual void init(madara::knowledge::KnowledgeBase & kb);

/**
* Executes the main thread logic
**/
virtual void run (void);
virtual void run(void);

private:
/// data plane if we want to access the knowledge base
Expand Down
24 changes: 12 additions & 12 deletions scripts/projects/common/src/transport.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,55 +5,55 @@

namespace knowledge = madara::knowledge;

transports::MyTransport::MyTransport (
transports::MyTransport::MyTransport(
const std::string & id,
madara::transport::TransportSettings & new_settings,
knowledge::KnowledgeBase & knowledge)
: madara::transport::Base (id, new_settings, knowledge.get_context ())
: madara::transport::Base(id, new_settings, knowledge.get_context())
{
// populate variables like buffer_ based on transport settings
Base::setup ();
Base::setup();

// set the data plane for read threads
read_threads_.set_data_plane (knowledge);
read_threads_.set_data_plane(knowledge);

// check the read hz settings to see if the user has passed something weird
double hertz = new_settings.read_thread_hertz;
if (hertz < 0.0)
if(hertz < 0.0)
{
hertz = 0.0;
}

// create the read threads specified in TransportSettings
for (uint32_t i = 0; i < new_settings.read_threads; ++i)
for(uint32_t i = 0; i < new_settings.read_threads; ++i)
{
// construct a unique id for a new thread
std::stringstream thread_name;
thread_name << "read";
thread_name << i;

// start the thread at the specified hertz
read_threads_.run (
read_threads_.run(
hertz,
thread_name.str (),
new MyTransportReadThread (
thread_name.str(),
new MyTransportReadThread(
id_, new_settings,
send_monitor_, receive_monitor_, packet_scheduler_));
}
}

transports::MyTransport::~MyTransport ()
transports::MyTransport::~MyTransport()
{
}

long
transports::MyTransport::send_data (
transports::MyTransport::send_data(
const madara::knowledge::KnowledgeMap &)
{
/**
* Return number of bytes sent or negative for error
**/
long result (0);
long result(0);

/**
* This is where you should do your custom transport sending logic/actions
Expand Down
8 changes: 4 additions & 4 deletions scripts/projects/common/src/transport.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,18 @@ namespace transports
public:
/**
* Constructor
* @param id unique identifier (generally host:port)
* @param id unique identifier(generally host:port)
* @param new_settings settings to apply to the transport
* @param context the knowledge record context
**/
MyTransport (const std::string & id,
MyTransport(const std::string & id,
madara::transport::TransportSettings & new_settings,
madara::knowledge::KnowledgeBase & context);

/**
* Destructor
**/
virtual ~MyTransport ();
virtual ~MyTransport();

/**
* Sends a list of updates to the domain. This function must be
Expand All @@ -36,7 +36,7 @@ namespace transports
* been updated and could be sent.
* @return result of operation or -1 if we are shutting down
**/
long send_data (const madara::knowledge::KnowledgeMap & modifieds) override;
long send_data(const madara::knowledge::KnowledgeMap & modifieds) override;

protected:
/// threads for monitoring knowledge updates
Expand Down
26 changes: 13 additions & 13 deletions scripts/projects/common/src/transport_thread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,55 +5,55 @@
namespace knowledge = madara::knowledge;

// constructor
transports::MyTransportReadThread::MyTransportReadThread (
transports::MyTransportReadThread::MyTransportReadThread(
const std::string & id,
const madara::transport::TransportSettings & settings,
madara::transport::BandwidthMonitor & send_monitor,
madara::transport::BandwidthMonitor & receive_monitor,
madara::transport::PacketScheduler & packet_scheduler)
: id_ (id),
: id_(id),
settings_(settings),
send_monitor_ (send_monitor),
receive_monitor_ (receive_monitor),
packet_scheduler_ (packet_scheduler)
send_monitor_(send_monitor),
receive_monitor_(receive_monitor),
packet_scheduler_(packet_scheduler)
{
}

// destructor
transports::MyTransportReadThread::~MyTransportReadThread ()
transports::MyTransportReadThread::~MyTransportReadThread()
{
}

/**
* Initialization to a knowledge base.
**/
void
transports::MyTransportReadThread::init (knowledge::KnowledgeBase & kb)
transports::MyTransportReadThread::init(knowledge::KnowledgeBase & kb)
{
// grab the context so we have access to update_from_external
context_ = &(kb.get_context ());
context_ = &(kb.get_context());

// setup the receive buffer
if (settings_.queue_length > 0)
if(settings_.queue_length > 0)
buffer_ = new char [settings_.queue_length];
}

/**
* Executes the actual thread logic.
**/
void
transports::MyTransportReadThread::run (void)
transports::MyTransportReadThread::run(void)
{
// prefix for logging purposes
const char * print_prefix = "transports::MyTransportReadThread";

/**
* the MADARA logger is thread-safe, fast, and allows for specifying
* various options like output files and multiple output targets (
* various options like output files and multiple output targets(
* e.g., std::cerr, a system log, and a thread_output.txt file). You
* can create your own custom log levels or loggers as well.
**/
madara_logger_ptr_log (madara::logger::global_logger.get (),
madara_logger_ptr_log(madara::logger::global_logger.get(),
madara::logger::LOG_MAJOR,
"%s::run: executing\n", print_prefix);

Expand Down Expand Up @@ -81,7 +81,7 @@ transports::MyTransportReadThread::run (void)
/**
* Calls filters on buffered data, updates throughput calculations
**/
process_received_update (buffer_.get_ptr (), bytes_read, id_, *context_,
process_received_update(buffer_.get_ptr(), bytes_read, id_, *context_,
settings_, send_monitor_, receive_monitor_, rebroadcast_records,
on_data_received_, print_prefix, remote_host, header);

Expand Down
10 changes: 5 additions & 5 deletions scripts/projects/common/src/transport_thread.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ namespace transports
/**
* Default constructor
**/
MyTransportReadThread (
MyTransportReadThread(
const std::string & id,
const madara::transport::TransportSettings & settings,
madara::transport::BandwidthMonitor & send_monitor,
Expand All @@ -27,24 +27,24 @@ namespace transports
/**
* Destructor
**/
virtual ~MyTransportReadThread ();
virtual ~MyTransportReadThread();

/**
* Initializes thread with MADARA context
* @param kb context for querying current program state
**/
virtual void init (madara::knowledge::KnowledgeBase & kb);
virtual void init(madara::knowledge::KnowledgeBase & kb);

/**
* Executes the main thread logic
**/
virtual void run (void);
virtual void run(void);

private:
/// data plane if we want to access the knowledge base
madara::knowledge::ThreadSafeContext * context_;

/// the unique id of this agent (probably a host:port pairing)
/// the unique id of this agent(probably a host:port pairing)
const std::string id_;

/// the transport settings being used
Expand Down
4 changes: 2 additions & 2 deletions scripts/projects/common/using_boost.mpb
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ project {
}

// b2 builds libboost_system with the following example formats:
// libboost_system-vc141-mt-gd-x64-1_67.lib (Debug)
// libboost_system-vc141-mt-x64-1_67.lib (Release)
// libboost_system-vc141-mt-gd-x64-1_67.lib(Debug)
// libboost_system-vc141-mt-x64-1_67.lib(Release)
// we want to allow Windows devs to customize their linked boost libs

expand(BOOST_TOOLSET) {
Expand Down

0 comments on commit 97fdcb6

Please sign in to comment.