Commit 5630b522 authored by Kitware Robot's avatar Kitware Robot Committed by Ben Boeckel

clang-format: format the entire codebase

This allows the robot to enforce formatting and fix formatting issues
automatically.
parent 6a034a08
Pipeline #56466 passed with stage

Too many changes to show.

To preserve performance only 297 of 297+ files are displayed.
......@@ -9,12 +9,14 @@
//=========================================================================
#include <functional>
struct favorite_int {
int operator() () { return 42; }
struct favorite_int
{
int operator()() { return 42; }
};
struct conditional_int {
int operator() (float x) { return 2 * static_cast<int>(x); }
struct conditional_int
{
int operator()(float x) { return 2 * static_cast<int>(x); }
};
int main(int, char**)
......@@ -23,5 +25,5 @@ int main(int, char**)
f = favorite_int();
std::function<int()> g;
g = std::bind<float>(conditional_int(), 21.0);
return (f() == 42 && g() == 42 ) ? 0 : 1;
return (f() == 42 && g() == 42) ? 0 : 1;
}
......@@ -13,12 +13,14 @@
#include <boost/functional.hpp>
#include <boost/mpl/placeholders.hpp>
struct favorite_int {
int operator() () { return 42; }
struct favorite_int
{
int operator()() { return 42; }
};
struct conditional_int {
int operator() (float x) { return 2 * static_cast<int>(x); }
struct conditional_int
{
int operator()(float x) { return 2 * static_cast<int>(x); }
};
int main(int, char**)
......@@ -27,5 +29,5 @@ int main(int, char**)
f = favorite_int();
boost::function<int()> g;
g = boost::bind<float>(conditional_int(), 21.0);
return (f() == 42 && g() == 42 ) ? 0 : 1;
return (f() == 42 && g() == 42) ? 0 : 1;
}
......@@ -9,12 +9,14 @@
//=========================================================================
#include <tr1/functional>
struct favorite_int {
int operator() () { return 42; }
struct favorite_int
{
int operator()() { return 42; }
};
struct conditional_int {
int operator() (float x) { return 2 * static_cast<int>(x); }
struct conditional_int
{
int operator()(float x) { return 2 * static_cast<int>(x); }
};
int main(int, char**)
......@@ -23,5 +25,5 @@ int main(int, char**)
f = favorite_int();
std::tr1::function<int()> g;
g = std::tr1::bind<float>(conditional_int(), 21.0);
return (f() == 42 && g() == 42 ) ? 0 : 1;
return (f() == 42 && g() == 42) ? 0 : 1;
}
......@@ -19,26 +19,30 @@
class vtkUnstructuredGrid;
namespace smtk {
namespace bridge {
namespace tutorial {
namespace smtk
{
namespace bridge
{
namespace tutorial
{
// ++ 2 ++
/// The types of entities in a VTK "model"
enum EntityType
{
VTK_POINT, // The entity is a point
VTK_CELL, // The entity is a vertex, edge, face, or volume
VTK_GROUP, // The entity is a group (of points and/or cells)
VTK_POINT_DATUM, // The entity is a property associated with a point
VTK_CELL_DATUM // The entity is a property associated with a cell
VTK_POINT, // The entity is a point
VTK_CELL, // The entity is a vertex, edge, face, or volume
VTK_GROUP, // The entity is a group (of points and/or cells)
VTK_POINT_DATUM, // The entity is a property associated with a point
VTK_CELL_DATUM // The entity is a property associated with a cell
};
/// A "handle" for a VTK entity (point, cell, property, etc.)
struct EntityHandle {
EntityType entityType; //!< Describes the type of VTK entity
int entityRelation; //!< A modifier for the entity type (to select an array or boundary)
vtkIdType entityId; //!< The offset in the array of entities describing this entity.
struct EntityHandle
{
EntityType entityType; //!< Describes the type of VTK entity
int entityRelation; //!< A modifier for the entity type (to select an array or boundary)
vtkIdType entityId; //!< The offset in the array of entities describing this entity.
};
// -- 2 --
......@@ -61,41 +65,31 @@ public:
smtk::model::EntityRef toEntityRef(const EntityHandle& ent);
// These methods may be provided as needed.
static int staticSetup(
const std::string& optName,
const smtk::model::StringList& optVal);
virtual int setup(
const std::string& optName,
const smtk::model::StringList& optVal);
static int staticSetup(const std::string& optName, const smtk::model::StringList& optVal);
virtual int setup(const std::string& optName, const smtk::model::StringList& optVal);
protected:
Session();
// This is required of every session:
virtual SessionInfoBits transcribeInternal(
const smtk::model::EntityRef& entity,
SessionInfoBits requestedInfo);
const smtk::model::EntityRef& entity, SessionInfoBits requestedInfo);
vtkSmartPointer<vtkUnstructuredGrid> Model;
// ... };
// -- 1 --
void addRelations(
smtk::model::EntityRef& entityref,
std::vector<EntityHandle>& rels,
SessionInfoBits requestedInfo,
int depth);
bool addTessellation(
const smtk::model::EntityRef&,
const EntityHandle&);
void addRelations(smtk::model::EntityRef& entityref, std::vector<EntityHandle>& rels,
SessionInfoBits requestedInfo, int depth);
bool addTessellation(const smtk::model::EntityRef&, const EntityHandle&);
private:
Session(const Session&); // Not implemented.
void operator = (const Session&); // Not implemented.
Session(const Session&); // Not implemented.
void operator=(const Session&); // Not implemented.
};
} // namespace tutorial
} // namespace bridge
} // namespace tutorial
} // namespace bridge
} // namespace smtk
#endif // __smtk_ex_session_h
......@@ -5,10 +5,7 @@
int main()
{
std::cout
<< "Compiled with SMTK version "
<< smtk::common::Version::number()
<< "\n";
std::cout << "Compiled with SMTK version " << smtk::common::Version::number() << "\n";
return 0;
}
// -- 1 --
......@@ -31,7 +31,8 @@ using namespace smtk::common;
using namespace smtk::model;
using smtk::attribute::IntItem;
namespace ex {
namespace ex
{
// ++ 2 ++
OperatorResult CounterOperator::operateInternal()
......@@ -40,28 +41,22 @@ OperatorResult CounterOperator::operateInternal()
OperatorSpecification params = this->specification();
// Get the input model to be processed:
Model model =
params->findModelEntity("model")->value();
Model model = params->findModelEntity("model")->value();
// Decide whether we should count cells or groups
// of the model:
int countGroups =
params->findInt("count groups")->value();
int countGroups = params->findInt("count groups")->value();
// Create the attribute holding the results of
// our operation using a convenience method
// provided by the Operator base class.
// Our operation is simple; we always succeed.
OperatorResult result =
this->createResult(OPERATION_SUCCEEDED);
OperatorResult result = this->createResult(OPERATION_SUCCEEDED);
// Fetch the item to store our output:
smtk::attribute::IntItemPtr cellCount =
result->findInt("count");
smtk::attribute::IntItemPtr cellCount = result->findInt("count");
cellCount->setValue(countGroups ?
model.groups().size() :
model.cells().size());
cellCount->setValue(countGroups ? model.groups().size() : model.cells().size());
return result;
}
......@@ -74,11 +69,11 @@ OperatorResult CounterOperator::operateInternal()
// and provide an auto-init object for registering the
// operator with the session.
smtkImplementsModelOperator(
/* no export symbol */, // Export symbol (none here)
ex::CounterOperator, // The class name (include all namespaces)
ex_counter, // The "component" name (for auto-init)
"counter", // The user-printable operator name.
implement_an_operator_xml, // An XML description (or NULL).
/* no export symbol */, // Export symbol (none here)
ex::CounterOperator, // The class name (include all namespaces)
ex_counter, // The "component" name (for auto-init)
"counter", // The user-printable operator name.
implement_an_operator_xml, // An XML description (or NULL).
smtk::model::DefaultSession); // The modeling kernel this operator uses.
// -- 3 --
......@@ -89,22 +84,18 @@ void testOperator(Model model)
// Ask the session to create an operator:
ex::CounterOperator::Ptr op =
smtk::dynamic_pointer_cast<ex::CounterOperator>(
session->op("counter"));
smtk::dynamic_pointer_cast<ex::CounterOperator>(session->op("counter"));
op->ensureSpecification();
smtk::attribute::ModelEntityItemPtr input =
op->specification()->findModelEntity("model");
smtk::attribute::ModelEntityItemPtr input = op->specification()->findModelEntity("model");
input->setValue(model);
test(!!op, "Could not create operator.");
test(
op->operate()->findInt("count")->value() == 1,
test(op->operate()->findInt("count")->value() == 1,
"Did not return the proper number of top-level cells.");
op->specification()->findInt("count groups")->setValue(1);
test(
op->operate()->findInt("count")->value() == 0,
test(op->operate()->findInt("count")->value() == 0,
"Did not return the proper number of top-level group.");
}
......@@ -121,12 +112,14 @@ int main()
model.setSession(session);
model.addCell(tet);
try {
try
{
testOperator(model);
} catch (const std::string& msg) {
(void) msg; // Ignore the message; it's already been printed.
}
catch (const std::string& msg)
{
(void)msg; // Ignore the message; it's already been printed.
std::cerr << "Exiting...\n";
status = -1;
}
......
......@@ -6,7 +6,8 @@
#include <string>
// ++ 1 ++
namespace ex {
namespace ex
{
class CounterOperator : public smtk::model::Operator
{
......@@ -16,15 +17,14 @@ public:
smtkSharedFromThisMacro(Operator);
smtkDeclareModelOperator();
// ...
// -- 1 --
// -- 1 --
// ++ 2 ++
virtual bool ableToOperate()
{ return this->ensureSpecification(); }
// ++ 2 ++
virtual bool ableToOperate() { return this->ensureSpecification(); }
protected:
virtual smtk::model::OperatorResult operateInternal();
// -- 2 --
// -- 2 --
};
} // namespace ex
......
......@@ -18,13 +18,11 @@
// See smtk/model/Session.h and its subclasses for an example of how
// these macros are used to register components with the model Manager.
#define smtkAutoInitComponentMacro(C) \
void C##_AutoInit_Construct(); \
#define smtkAutoInitComponentMacro(C) \
void C##_AutoInit_Construct(); \
void C##_AutoInit_Destruct();
#define smtkAutoInitConstructMacro(C) \
C##_AutoInit_Construct();
#define smtkAutoInitDestructMacro(C) \
C##_AutoInit_Destruct();
#define smtkAutoInitConstructMacro(C) C##_AutoInit_Construct();
#define smtkAutoInitDestructMacro(C) C##_AutoInit_Destruct();
/**\brief Register an SMTK component for use.
*
......@@ -45,13 +43,13 @@
* dynamic C++ initialization and and the global function
* smtk_cgm_session_AutoInit_Destruct is called during finalization.
*/
#define smtkComponentInitMacro(C) \
smtkAutoInitComponentMacro(C) \
static struct C##_ComponentInit { \
/* Call <mod>_AutoInit_Construct during initialization. */ \
C##_ComponentInit() { smtkAutoInitConstructMacro(C) } \
/* Call <mod>_AutoInit_Destruct during finalization. */ \
~C##_ComponentInit() { smtkAutoInitDestructMacro(C) } \
#define smtkComponentInitMacro(C) \
smtkAutoInitComponentMacro(C) static struct C##_ComponentInit \
{ \
/* Call <mod>_AutoInit_Construct during initialization. */ \
C##_ComponentInit() { smtkAutoInitConstructMacro(C) } \
/* Call <mod>_AutoInit_Destruct during finalization. */ \
~C##_ComponentInit() { smtkAutoInitDestructMacro(C) } \
} C##_ComponentInit_Instance;
#endif // __smtk_AutoInit_h
......@@ -23,407 +23,414 @@
namespace smtk
{
namespace common
{
class Resource;
class ResourceSet;
class UUID;
class UUIDGenerator;
class View;
typedef std::set<UUID> UUIDs;
typedef std::vector<UUID> UUIDArray;
}
namespace attribute
{
class Attribute;
class RefItem;
class RefItemDefinition;
class DateTimeItem;
class DateTimeItemDefinition;
class Definition;
class DirectoryItem;
class DirectoryItemDefinition;
class DoubleItem;
class DoubleItemDefinition;
class FileItem;
class FileItemDefinition;
class FileSystemItem;
class FileSystemItemDefinition;
class GroupItem;
class GroupItemDefinition;
class IntItem;
class IntItemDefinition;
class Item;
class ItemDefinition;
class System;
class MeshItem;
class MeshItemDefinition;
class MeshSelectionItem;
class MeshSelectionItemDefinition;
class ModelEntityItem;
class ModelEntityItemDefinition;
class StringItem;
class StringItemDefinition;
class ValueItem;
class ValueItemDefinition;
class VoidItem;
class VoidItemDefinition;
}
namespace mesh
{
class Manager;
class Collection;
class Interface;
class Allocator;
class BufferedCellAllocator;
class IncrementalAllocator;
class ConnectivityStorage;
class PointLocatorImpl;
namespace moab
{
class Interface;
}
namespace json
{
class Interface;
}
}
namespace common
{
class Resource;
class ResourceSet;
class UUID;
class UUIDGenerator;
class View;
typedef std::set<UUID> UUIDs;
typedef std::vector<UUID> UUIDArray;
}
namespace attribute
{
class Attribute;
class RefItem;
class RefItemDefinition;
class DateTimeItem;
class DateTimeItemDefinition;
class Definition;
class DirectoryItem;
class DirectoryItemDefinition;
class DoubleItem;
class DoubleItemDefinition;
class FileItem;
class FileItemDefinition;
class FileSystemItem;
class FileSystemItemDefinition;
class GroupItem;
class GroupItemDefinition;
class IntItem;
class IntItemDefinition;
class Item;
class ItemDefinition;
class System;
class MeshItem;
class MeshItemDefinition;
class MeshSelectionItem;
class MeshSelectionItemDefinition;
class ModelEntityItem;
class ModelEntityItemDefinition;
class StringItem;
class StringItemDefinition;
class ValueItem;
class ValueItemDefinition;
class VoidItem;
class VoidItemDefinition;
}
namespace model
{
class Arrangement;
class ArrangementHelper;
class ArrangementReference;
typedef std::vector<smtk::model::ArrangementReference> ArrangementReferences;
class AttributeListPhrase;
typedef std::vector<smtk::model::Arrangement> Arrangements;
class AuxiliaryGeometry;
typedef std::vector<smtk::model::AuxiliaryGeometry> AuxiliaryGeometries;
class Manager;
class Session;
class SessionRef;
typedef std::vector<smtk::model::SessionRef> SessionRefs;
class SessionIO;
class SessionIOJSON;
class CellEntity;
typedef std::vector<smtk::model::CellEntity> Cells;
typedef std::set<smtk::model::CellEntity> CellSet;
class Chain;
typedef std::vector<smtk::model::Chain> Chains;
class EntityRef;
typedef std::set<smtk::model::EntityRef> EntityRefs;
typedef std::vector<smtk::model::EntityRef> EntityRefArray;
class DefaultSession;
class DescriptivePhrase;
class Edge;
typedef std::vector<smtk::model::Edge> Edges;
typedef std::set<smtk::model::Edge> EdgeSet;
class EdgeUse;
typedef std::vector<smtk::model::EdgeUse> EdgeUses;
class EntityPhrase;
class EntityListPhrase;
class Face;
typedef std::vector<smtk::model::Face> Faces;
typedef std::set<smtk::model::Face> FaceSet;
class FaceUse;
typedef std::vector<smtk::model::FaceUse> FaceUses;
class GridInfo;
class GridInfo2D;
class GridInfo3D;
class Group;
class Instance;
class Loop;
typedef std::vector<smtk::model::Loop> Loops;
class Entity;
class MeshPhrase;
class MeshListPhrase;
class Model;
typedef std::vector<Model> Models;
class Operator;
class PropertyValuePhrase;
class PropertyListPhrase;
class RemoteOperator;
class Shell;
typedef std::vector<smtk::model::Shell> Shells;
class ShellEntity;
typedef std::vector<smtk::model::ShellEntity> ShellEntities;
class Manager;
class SimpleModelSubphrases;
class StoredResource;
class SubphraseGenerator;
class Tessellation;
class UseEntity;
typedef std::vector<smtk::model::UseEntity> UseEntities;
class Vertex;
typedef std::vector<smtk::model::Vertex> Vertices;
typedef std::set<smtk::model::Vertex> VertexSet;
class VertexUse;
typedef std::vector<smtk::model::VertexUse> VertexUses;
class Volume;
typedef std::vector<smtk::model::Volume> Volumes;
class VolumeUse;
typedef std::vector<smtk::model::VolumeUse> VolumeUses;
}
namespace mesh
{
class Manager;
class Collection;
class Interface;
class Allocator;
class BufferedCellAllocator;
class IncrementalAllocator;
class ConnectivityStorage;
class PointLocatorImpl;
namespace moab
{
class Interface;
}
namespace bridge
{
// These classes are in the SMTKRemote library, which
// is only built when SMTK_ENABLE_REMUS_SUPPORT is ON.
// However, we do not #ifdef these declarations since
// that would introduce a dependency on a generated
// header that could cause frequent recompilation.
namespace remote
{
class Session;
class RemusConnection;
class RemusConnections;
class RemusRPCWorker;
}
}