Skip to content

Commit b532bd0

Browse files
Run clang-format on all files
1 parent 08b2707 commit b532bd0

File tree

648 files changed

+141885
-136620
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

648 files changed

+141885
-136620
lines changed
Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
#include <mujoco/mujoco.h>
22

33
// Just checking that we can actually run a mujoco function
4-
int main(int argc, char** argv) {
5-
auto res = mju_min(0, 1);
6-
return res == 0 ? 0 : 1;
4+
int
5+
main(int argc, char** argv)
6+
{
7+
auto res = mju_min(0, 1);
8+
return res == 0 ? 0 : 1;
79
}

src/architecture/_GeneralModuleFiles/sys_model.cpp

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,13 @@
2121
#include "architecture/utilities/moduleIdGenerator/moduleIdGenerator.h"
2222

2323
SysModel::SysModel()
24-
: moduleID(ModuleIdGenerator::GetInstance()->checkoutModuleID())
25-
{}
24+
: moduleID(ModuleIdGenerator::GetInstance()->checkoutModuleID())
25+
{
26+
}
2627

27-
SysModel::SysModel(const SysModel &obj)
28-
: ModelTag{obj.ModelTag},
29-
RNGSeed{obj.RNGSeed},
30-
moduleID{ModuleIdGenerator::GetInstance()->checkoutModuleID()}
31-
{}
28+
SysModel::SysModel(const SysModel& obj)
29+
: ModelTag{ obj.ModelTag }
30+
, RNGSeed{ obj.RNGSeed }
31+
, moduleID{ ModuleIdGenerator::GetInstance()->checkoutModuleID() }
32+
{
33+
}

src/architecture/_GeneralModuleFiles/sys_model.h

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,13 @@
2121
#define _SysModel_HH_
2222

2323
#include <architecture/utilities/bskLogging.h>
24-
#include <string>
2524
#include <stdint.h>
25+
#include <string>
2626

2727
/*! @brief Simulation System Model Class */
2828
class SysModel
2929
{
30-
public:
30+
public:
3131
SysModel();
3232

3333
/**
@@ -38,27 +38,26 @@ class SysModel
3838
*
3939
* @param obj The SysModel object to copy data from.
4040
*/
41-
SysModel(const SysModel &obj);
41+
SysModel(const SysModel& obj);
4242

43-
virtual ~SysModel(){};
43+
virtual ~SysModel() {};
4444

4545
/** Initializes the module, create messages */
46-
virtual void SelfInit(){};
46+
virtual void SelfInit() {};
4747

4848
/** ??? */
49-
virtual void IntegratedInit(){};
49+
virtual void IntegratedInit() {};
5050

5151
/** Reads incoming messages, performs module actions, writes output messages */
52-
virtual void UpdateState(uint64_t CurrentSimNanos){};
52+
virtual void UpdateState(uint64_t CurrentSimNanos) {};
5353

5454
/** Called at simulation initialization, resets module to specified time */
55-
virtual void Reset(uint64_t CurrentSimNanos){};
55+
virtual void Reset(uint64_t CurrentSimNanos) {};
5656

5757
std::string ModelTag = ""; //!< Basilisk module tag name
5858
uint64_t CallCounts = 0; //!< Counts on the model being called
5959
uint32_t RNGSeed = 0x1badcad1; //!< Giving everyone a random seed for ease of MC
6060
int64_t moduleID; //!< Module ID for this module (handed out by module_id_generator)
6161
};
6262

63-
6463
#endif /* _SYS_MODEL_H_ */

src/architecture/_GeneralModuleFiles/sys_model_task.cpp

100755100644
Lines changed: 29 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -25,49 +25,50 @@
2525
@param FirstStartTime The amount of time in nanoseconds to hold a task dormant before starting.
2626
After this time the task is executed at integer amounts of InputPeriod again
2727
*/
28-
SysModelTask::SysModelTask(uint64_t InputPeriod, uint64_t FirstStartTime) :
29-
NextStartTime(FirstStartTime), TaskPeriod(InputPeriod), FirstTaskTime(FirstStartTime)
28+
SysModelTask::SysModelTask(uint64_t InputPeriod, uint64_t FirstStartTime)
29+
: NextStartTime(FirstStartTime)
30+
, TaskPeriod(InputPeriod)
31+
, FirstTaskTime(FirstStartTime)
3032
{
3133
this->NextPickupTime = this->NextStartTime + this->TaskPeriod;
3234
}
3335

3436
/*! This method self-initializes all of the models that have been added to the Task.
3537
*/
36-
void SysModelTask::SelfInitTaskList() const
38+
void
39+
SysModelTask::SelfInitTaskList() const
3740
{
3841
//! - Loop over all models and do the self init for each
39-
for(auto const& modelPair : this->TaskModels)
40-
{
42+
for (auto const& modelPair : this->TaskModels) {
4143
SysModel* NonIt = modelPair.ModelPtr;
4244
NonIt->SelfInit();
4345
}
4446
}
4547

46-
4748
/*! This method resets all of the models that have been added to the Task at the CurrentSimTime.
4849
See sys_model_task.h for related method ResetTask()
4950
@param CurrentSimTime The time to start at after reset
5051
*/
51-
void SysModelTask::ResetTaskList(uint64_t CurrentSimTime)
52+
void
53+
SysModelTask::ResetTaskList(uint64_t CurrentSimTime)
5254
{
53-
for (auto const& modelPair : this->TaskModels)
54-
{
55-
modelPair.ModelPtr->Reset(CurrentSimTime);
56-
}
57-
this->NextStartTime = CurrentSimTime;
55+
for (auto const& modelPair : this->TaskModels) {
56+
modelPair.ModelPtr->Reset(CurrentSimTime);
57+
}
58+
this->NextStartTime = CurrentSimTime;
5859
this->NextPickupTime = this->NextStartTime + this->TaskPeriod;
5960
}
6061

6162
/*! This method executes all of the models on the Task during runtime.
6263
Then, it sets its NextStartTime appropriately.
6364
@param CurrentSimNanos The current simulation time in [ns]
6465
*/
65-
void SysModelTask::ExecuteTaskList(uint64_t CurrentSimNanos)
66+
void
67+
SysModelTask::ExecuteTaskList(uint64_t CurrentSimNanos)
6668
{
6769
//! - Loop over all of the models in the simulation and call their UpdateState
68-
for(auto ModelPair = this->TaskModels.begin(); (ModelPair != this->TaskModels.end() && this->taskActive);
69-
ModelPair++)
70-
{
70+
for (auto ModelPair = this->TaskModels.begin(); (ModelPair != this->TaskModels.end() && this->taskActive);
71+
ModelPair++) {
7172
SysModel* NonIt = (ModelPair->ModelPtr);
7273
NonIt->UpdateState(CurrentSimNanos);
7374
NonIt->CallCounts += 1;
@@ -81,21 +82,19 @@ void SysModelTask::ExecuteTaskList(uint64_t CurrentSimNanos)
8182
@param NewModel The new model that we are adding to the Task
8283
@param Priority The selected priority of the model being added (highest goes first)
8384
*/
84-
void SysModelTask::AddNewObject(SysModel *NewModel, int32_t Priority)
85+
void
86+
SysModelTask::AddNewObject(SysModel* NewModel, int32_t Priority)
8587
{
8688
ModelPriorityPair LocalPair;
8789

8890
//! - Set the local pair with the requested priority and mode
8991
LocalPair.CurrentModelPriority = Priority;
9092
LocalPair.ModelPtr = NewModel;
91-
// SystemMessaging::GetInstance()->addModuleToProcess(NewModel->moduleID,
92-
// parentProc);
93+
// SystemMessaging::GetInstance()->addModuleToProcess(NewModel->moduleID,
94+
// parentProc);
9395
//! - Loop through the ModelPair vector and if Priority is higher than next, insert
94-
for(auto ModelPair = this->TaskModels.begin(); ModelPair != this->TaskModels.end();
95-
ModelPair++)
96-
{
97-
if(Priority > ModelPair->CurrentModelPriority)
98-
{
96+
for (auto ModelPair = this->TaskModels.begin(); ModelPair != this->TaskModels.end(); ModelPair++) {
97+
if (Priority > ModelPair->CurrentModelPriority) {
9998
this->TaskModels.insert(ModelPair, LocalPair);
10099
return;
101100
}
@@ -109,24 +108,21 @@ void SysModelTask::AddNewObject(SysModel *NewModel, int32_t Priority)
109108
was specified at task creation.
110109
@param newPeriod The period that the task should run at going forward
111110
*/
112-
void SysModelTask::updatePeriod(uint64_t newPeriod)
111+
void
112+
SysModelTask::updatePeriod(uint64_t newPeriod)
113113
{
114114
//! - If the requested time is above the min time, set the next time based on the previous time plus the new period
115-
if(this->NextStartTime > this->TaskPeriod)
116-
{
117-
uint64_t newStartTime = (this->NextStartTime/newPeriod)*newPeriod;
118-
if(newStartTime <= (this->NextStartTime - this->TaskPeriod))
119-
{
115+
if (this->NextStartTime > this->TaskPeriod) {
116+
uint64_t newStartTime = (this->NextStartTime / newPeriod) * newPeriod;
117+
if (newStartTime <= (this->NextStartTime - this->TaskPeriod)) {
120118
newStartTime += newPeriod;
121119
}
122120
this->NextStartTime = newStartTime;
123121
}
124122
//! - Otherwise, we just should keep the original requested first call time for the task
125-
else
126-
{
123+
else {
127124
this->NextStartTime = this->FirstTaskTime;
128125
}
129126
//! - Change the period of the task so that future calls will be based on the new period
130127
this->TaskPeriod = newPeriod;
131-
132128
}

src/architecture/_GeneralModuleFiles/sys_model_task.h

100755100644
Lines changed: 29 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -26,39 +26,44 @@
2626
#include <vector>
2727

2828
//! Structure used to pair a model and its requested priority
29-
typedef struct {
30-
int32_t CurrentModelPriority; //!< The current model priority. Higher goes first
31-
SysModel *ModelPtr; //!< The model associated with this priority
32-
}ModelPriorityPair;
29+
typedef struct
30+
{
31+
int32_t CurrentModelPriority; //!< The current model priority. Higher goes first
32+
SysModel* ModelPtr; //!< The model associated with this priority
33+
} ModelPriorityPair;
3334

3435
//! Class used to group a set of models into one "Task" of execution
3536
class SysModelTask
3637
{
3738

38-
public:
39-
SysModelTask()=default;
40-
explicit SysModelTask(uint64_t InputPeriod, uint64_t FirstStartTime=0); //!< class method
41-
~SysModelTask()=default;
42-
void AddNewObject(SysModel *NewModel, int32_t Priority = -1);
39+
public:
40+
SysModelTask() = default;
41+
explicit SysModelTask(uint64_t InputPeriod, uint64_t FirstStartTime = 0); //!< class method
42+
~SysModelTask() = default;
43+
void AddNewObject(SysModel* NewModel, int32_t Priority = -1);
4344
void SelfInitTaskList() const;
44-
//void CrossInitTaskList();
45+
// void CrossInitTaskList();
4546
void ExecuteTaskList(uint64_t CurrentSimTime);
46-
void ResetTaskList(uint64_t CurrentSimTime);
47-
void ResetTask() {this->NextStartTime = this->FirstTaskTime;} //!< Resets the task
48-
void enableTask() {this->taskActive = true;} //!< Enables the task. Great comment huh?
49-
void disableTask() {this->taskActive = false;} //!< Disables the task. I know.
47+
void ResetTaskList(uint64_t CurrentSimTime);
48+
void ResetTask() { this->NextStartTime = this->FirstTaskTime; } //!< Resets the task
49+
void enableTask() { this->taskActive = true; } //!< Enables the task. Great comment huh?
50+
void disableTask() { this->taskActive = false; } //!< Disables the task. I know.
5051
void updatePeriod(uint64_t newPeriod);
51-
void updateParentProc(std::string const& parent) {this->parentProc = parent;} //!< Allows the system to move task to a different process
52+
void updateParentProc(std::string const& parent)
53+
{
54+
this->parentProc = parent;
55+
} //!< Allows the system to move task to a different process
5256

53-
std::vector<ModelPriorityPair> TaskModels{}; //!< -- Array that has pointers to all task sysModels
54-
std::string TaskName{}; //!< -- Identifier for Task
55-
std::string parentProc; //!< -- Process that calls this task
56-
uint64_t NextStartTime=0; //!< [ns] Next time to start task
57-
uint64_t NextPickupTime=0; //!< [ns] Next time read Task outputs
58-
uint64_t TaskPeriod=100; //!< [ns] Cycle rate for Task
59-
uint64_t FirstTaskTime=0; //!< [ns] Time to start Task for first time. After this time the normal periodic updates resume.
60-
bool taskActive=true; //!< -- Flag indicating whether the Task has been disabled
61-
BSKLogger bskLogger; //!< -- BSK Logging
57+
std::vector<ModelPriorityPair> TaskModels{}; //!< -- Array that has pointers to all task sysModels
58+
std::string TaskName{}; //!< -- Identifier for Task
59+
std::string parentProc; //!< -- Process that calls this task
60+
uint64_t NextStartTime = 0; //!< [ns] Next time to start task
61+
uint64_t NextPickupTime = 0; //!< [ns] Next time read Task outputs
62+
uint64_t TaskPeriod = 100; //!< [ns] Cycle rate for Task
63+
uint64_t FirstTaskTime =
64+
0; //!< [ns] Time to start Task for first time. After this time the normal periodic updates resume.
65+
bool taskActive = true; //!< -- Flag indicating whether the Task has been disabled
66+
BSKLogger bskLogger; //!< -- BSK Logging
6267
};
6368

6469
#endif /* _SysModelTask_H_ */

src/architecture/alg_contain/alg_contain.cpp

100755100644
Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -23,47 +23,47 @@ AlgContain::AlgContain()
2323
AlgSelfInit = NULL;
2424
AlgUpdate = NULL;
2525
DataPtr = NULL;
26-
AlgReset = NULL;
26+
AlgReset = NULL;
2727
CallCounts = 0;
2828
return;
2929
}
3030

31-
AlgContain::AlgContain(void *DataIn, void(*UpPtr) (void*, uint64_t, uint64_t),
31+
AlgContain::AlgContain(void* DataIn,
32+
void (*UpPtr)(void*, uint64_t, uint64_t),
3233
void (*SelfPtr)(void*, uint64_t),
33-
void (*ResetPtr) (void*, uint64_t, uint64_t))
34+
void (*ResetPtr)(void*, uint64_t, uint64_t))
3435
{
3536
DataPtr = DataIn;
3637
AlgSelfInit = SelfPtr;
3738
AlgUpdate = UpPtr;
38-
AlgReset = ResetPtr;
39+
AlgReset = ResetPtr;
3940
}
4041

4142
AlgContain::~AlgContain()
4243
{
4344
return;
4445
}
4546

46-
void AlgContain::SelfInit()
47+
void
48+
AlgContain::SelfInit()
4749
{
48-
if(AlgSelfInit != NULL)
49-
{
50-
AlgSelfInit(DataPtr, (uint32_t) moduleID);
50+
if (AlgSelfInit != NULL) {
51+
AlgSelfInit(DataPtr, (uint32_t)moduleID);
5152
}
5253
}
5354

54-
55-
void AlgContain::UpdateState(uint64_t CurrentSimNanos)
55+
void
56+
AlgContain::UpdateState(uint64_t CurrentSimNanos)
5657
{
57-
if(AlgUpdate != NULL)
58-
{
59-
AlgUpdate(DataPtr, CurrentSimNanos, (uint32_t) moduleID);
58+
if (AlgUpdate != NULL) {
59+
AlgUpdate(DataPtr, CurrentSimNanos, (uint32_t)moduleID);
6060
}
6161
}
6262

63-
void AlgContain::Reset(uint64_t CurrentSimNanos)
63+
void
64+
AlgContain::Reset(uint64_t CurrentSimNanos)
6465
{
65-
if (AlgReset != NULL)
66-
{
67-
AlgReset(DataPtr, CurrentSimNanos, (uint32_t) moduleID);
68-
}
66+
if (AlgReset != NULL) {
67+
AlgReset(DataPtr, CurrentSimNanos, (uint32_t)moduleID);
68+
}
6969
}

0 commit comments

Comments
 (0)