Update class, struct and enum bracket style

This commit is contained in:
Tiago Gomes 2013-02-13 14:26:47 +00:00
parent e178c1af04
commit 2bc123d72c
26 changed files with 80 additions and 139 deletions

View File

@ -11,8 +11,7 @@
namespace Horus { namespace Horus {
struct ScheduleInfo struct ScheduleInfo {
{
ScheduleInfo (BBNode* n, bool vfp, bool vfc) ScheduleInfo (BBNode* n, bool vfp, bool vfc)
: node(n), visitedFromParent(vfp), visitedFromChild(vfc) { } : node(n), visitedFromParent(vfp), visitedFromChild(vfc) { }
@ -25,8 +24,7 @@ struct ScheduleInfo
typedef std::queue<ScheduleInfo, std::list<ScheduleInfo>> Scheduling; typedef std::queue<ScheduleInfo, std::list<ScheduleInfo>> Scheduling;
class BayesBall class BayesBall {
{
public: public:
BayesBall (FactorGraph& fg); BayesBall (FactorGraph& fg);

View File

@ -9,8 +9,7 @@
namespace Horus { namespace Horus {
class BBNode : public Var class BBNode : public Var {
{
public: public:
BBNode (Var* v) : Var (v), visited_(false), BBNode (Var* v) : Var (v), visited_(false),
markedOnTop_(false), markedOnBottom_(false) { } markedOnTop_(false), markedOnBottom_(false) { }
@ -51,8 +50,7 @@ class BBNode : public Var
}; };
class BayesBallGraph class BayesBallGraph {
{
public: public:
BayesBallGraph (void) { } BayesBallGraph (void) { }

View File

@ -19,8 +19,7 @@ enum MsgSchedule {
}; };
class BpLink class BpLink {
{
public: public:
BpLink (FacNode* fn, VarNode* vn); BpLink (FacNode* fn, VarNode* vn);
@ -60,20 +59,22 @@ class BpLink
typedef std::vector<BpLink*> BpLinks; typedef std::vector<BpLink*> BpLinks;
class SPNodeInfo class SPNodeInfo {
{
public: public:
SPNodeInfo (void) { } SPNodeInfo (void) { }
void addBpLink (BpLink* link) { links_.push_back (link); } void addBpLink (BpLink* link) { links_.push_back (link); }
const BpLinks& getLinks (void) { return links_; } const BpLinks& getLinks (void) { return links_; }
private: private:
BpLinks links_; BpLinks links_;
DISALLOW_COPY_AND_ASSIGN (SPNodeInfo); DISALLOW_COPY_AND_ASSIGN (SPNodeInfo);
}; };
class BeliefProp : public GroundSolver class BeliefProp : public GroundSolver {
{
public: public:
BeliefProp (const FactorGraph&); BeliefProp (const FactorGraph&);

View File

@ -22,8 +22,7 @@ typedef std::vector<CTNode*> CTNodes;
typedef std::vector<ConstraintTree*> ConstraintTrees; typedef std::vector<ConstraintTree*> ConstraintTrees;
class CTNode class CTNode {
{
private: private:
struct CmpSymbol { struct CmpSymbol {
bool operator() (const CTNode* n1, const CTNode* n2) const { bool operator() (const CTNode* n1, const CTNode* n2) const {
@ -100,8 +99,7 @@ CTNode::findSymbol (Symbol symb)
std::ostream& operator<< (std::ostream&, const CTNode&); std::ostream& operator<< (std::ostream&, const CTNode&);
class ConstraintTree class ConstraintTree {
{
public: public:
ConstraintTree (unsigned); ConstraintTree (unsigned);
@ -209,8 +207,7 @@ class ConstraintTree
std::vector<std::pair<CTNode*, unsigned>> countNormalize ( std::vector<std::pair<CTNode*, unsigned>> countNormalize (
const CTNode*, unsigned); const CTNode*, unsigned);
static void split ( static void split (CTNode*, CTNode*, CTChilds&, CTChilds&, unsigned);
CTNode*, CTNode*, CTChilds&, CTChilds&, unsigned);
CTNode* root_; CTNode* root_;
LogVars logVars_; LogVars logVars_;

View File

@ -67,8 +67,7 @@ template <typename T> struct hash<std::vector<T>>
namespace Horus { namespace Horus {
class VarCluster class VarCluster {
{
public: public:
VarCluster (const VarNodes& vs) : members_(vs) { } VarCluster (const VarNodes& vs) : members_(vs) { }
@ -88,8 +87,7 @@ class VarCluster
}; };
class FacCluster class FacCluster {
{
public: public:
FacCluster (const FacNodes& fcs, const VarClusters& vcs) FacCluster (const FacNodes& fcs, const VarClusters& vcs)
: members_(fcs), varClusters_(vcs) { } : members_(fcs), varClusters_(vcs) { }
@ -113,8 +111,7 @@ class FacCluster
}; };
class CountingBp : public GroundSolver class CountingBp : public GroundSolver {
{
public: public:
CountingBp (const FactorGraph& fg); CountingBp (const FactorGraph& fg);

View File

@ -18,8 +18,7 @@ class EgNode;
typedef TinySet<EgNode*> EGNeighs; typedef TinySet<EgNode*> EGNeighs;
enum ElimHeuristic enum ElimHeuristic {
{
SEQUENTIAL, SEQUENTIAL,
MIN_NEIGHBORS, MIN_NEIGHBORS,
MIN_WEIGHT, MIN_WEIGHT,
@ -28,8 +27,7 @@ enum ElimHeuristic
}; };
class EgNode : public Var class EgNode : public Var {
{
public: public:
EgNode (VarId vid, unsigned range) : Var (vid, range) { } EgNode (VarId vid, unsigned range) : Var (vid, range) { }
@ -46,8 +44,7 @@ class EgNode : public Var
}; };
class ElimGraph class ElimGraph {
{
public: public:
ElimGraph (const Factors&); ElimGraph (const Factors&);

View File

@ -13,8 +13,7 @@
namespace Horus { namespace Horus {
template <typename T> template <typename T>
class TFactor class TFactor {
{
public: public:
const std::vector<T>& arguments (void) const { return args_; } const std::vector<T>& arguments (void) const { return args_; }
@ -327,8 +326,7 @@ TFactor<T>::cartesianProduct (
class Factor : public TFactor<VarId> class Factor : public TFactor<VarId> {
{
public: public:
Factor (void) { } Factor (void) { }

View File

@ -16,8 +16,7 @@ namespace Horus {
class FacNode; class FacNode;
class VarNode : public Var class VarNode : public Var {
{
public: public:
VarNode (VarId varId, unsigned nrStates, VarNode (VarId varId, unsigned nrStates,
int evidence = Constants::NO_EVIDENCE) int evidence = Constants::NO_EVIDENCE)
@ -37,8 +36,7 @@ class VarNode : public Var
class FacNode class FacNode {
{
public: public:
FacNode (const Factor& f) : factor_(f), index_(-1) { } FacNode (const Factor& f) : factor_(f), index_(-1) { }
@ -66,8 +64,7 @@ class FacNode
class FactorGraph class FactorGraph {
{
public: public:
FactorGraph (void) : bayesFactors_(false) { } FactorGraph (void) : bayesFactors_(false) { }

View File

@ -7,8 +7,7 @@
namespace Horus { namespace Horus {
class GroundSolver class GroundSolver {
{
public: public:
GroundSolver (const FactorGraph& factorGraph) : fg(factorGraph) { } GroundSolver (const FactorGraph& factorGraph) : fg(factorGraph) { }

View File

@ -11,8 +11,7 @@ typedef std::vector<unsigned> Histogram;
namespace Horus { namespace Horus {
class HistogramSet class HistogramSet {
{
public: public:
HistogramSet (unsigned, unsigned); HistogramSet (unsigned, unsigned);

View File

@ -34,16 +34,14 @@ typedef std::vector<unsigned> Ranges;
typedef unsigned long long ullong; typedef unsigned long long ullong;
enum LiftedSolverType enum LiftedSolverType {
{
LVE, // generalized counting first-order variable elimination (GC-FOVE) LVE, // generalized counting first-order variable elimination (GC-FOVE)
LBP, // lifted first-order belief propagation LBP, // lifted first-order belief propagation
LKC // lifted first-order knowledge compilation LKC // lifted first-order knowledge compilation
}; };
enum GroundSolverType enum GroundSolverType {
{
VE, // variable elimination VE, // variable elimination
BP, // belief propagation BP, // belief propagation
CBP // counting belief propagation CBP // counting belief propagation

View File

@ -12,8 +12,7 @@
namespace Horus { namespace Horus {
class Indexer class Indexer {
{
public: public:
Indexer (const Ranges& ranges, bool calcOffsets = true); Indexer (const Ranges& ranges, bool calcOffsets = true);
@ -200,8 +199,7 @@ operator<< (std::ostream& os, const Indexer& indexer)
class MapIndexer class MapIndexer {
{
public: public:
MapIndexer (const Ranges& ranges, const std::vector<bool>& mask); MapIndexer (const Ranges& ranges, const std::vector<bool>& mask);

View File

@ -12,16 +12,15 @@ namespace Horus {
class FactorGraph; class FactorGraph;
class WeightedBp; class WeightedBp;
class LiftedBp : public LiftedSolver class LiftedBp : public LiftedSolver{
{
public: public:
LiftedBp (const ParfactorList& pfList); LiftedBp (const ParfactorList& pfList);
~LiftedBp (void); ~LiftedBp (void);
Params solveQuery (const Grounds&); Params solveQuery (const Grounds&);
void printSolverFlags (void) const; void printSolverFlags (void) const;
private: private:
void refineParfactors (void); void refineParfactors (void);

View File

@ -27,8 +27,7 @@ enum CircuitNodeType {
class CircuitNode class CircuitNode {
{
public: public:
CircuitNode (void) { } CircuitNode (void) { }
@ -39,8 +38,7 @@ class CircuitNode
class OrNode : public CircuitNode class OrNode : public CircuitNode {
{
public: public:
OrNode (void) : CircuitNode(), leftBranch_(0), rightBranch_(0) { } OrNode (void) : CircuitNode(), leftBranch_(0), rightBranch_(0) { }
@ -58,8 +56,7 @@ class OrNode : public CircuitNode
class AndNode : public CircuitNode class AndNode : public CircuitNode {
{
public: public:
AndNode (void) : CircuitNode(), leftBranch_(0), rightBranch_(0) { } AndNode (void) : CircuitNode(), leftBranch_(0), rightBranch_(0) { }
@ -80,8 +77,7 @@ class AndNode : public CircuitNode
class SetOrNode : public CircuitNode class SetOrNode : public CircuitNode {
{
public: public:
SetOrNode (unsigned nrGroundings) SetOrNode (unsigned nrGroundings)
: CircuitNode(), follow_(0), nrGroundings_(nrGroundings) { } : CircuitNode(), follow_(0), nrGroundings_(nrGroundings) { }
@ -107,8 +103,7 @@ class SetOrNode : public CircuitNode
class SetAndNode : public CircuitNode class SetAndNode : public CircuitNode {
{
public: public:
SetAndNode (unsigned nrGroundings) SetAndNode (unsigned nrGroundings)
: CircuitNode(), follow_(0), nrGroundings_(nrGroundings) { } : CircuitNode(), follow_(0), nrGroundings_(nrGroundings) { }
@ -126,8 +121,7 @@ class SetAndNode : public CircuitNode
class IncExcNode : public CircuitNode class IncExcNode : public CircuitNode {
{
public: public:
IncExcNode (void) IncExcNode (void)
: CircuitNode(), plus1Branch_(0), plus2Branch_(0), minusBranch_(0) { } : CircuitNode(), plus1Branch_(0), plus2Branch_(0), minusBranch_(0) { }
@ -148,8 +142,7 @@ class IncExcNode : public CircuitNode
class LeafNode : public CircuitNode class LeafNode : public CircuitNode {
{
public: public:
LeafNode (Clause* clause, const LiftedWCNF& lwcnf) LeafNode (Clause* clause, const LiftedWCNF& lwcnf)
: CircuitNode(), clause_(clause), lwcnf_(lwcnf) { } : CircuitNode(), clause_(clause), lwcnf_(lwcnf) { }
@ -169,8 +162,7 @@ class LeafNode : public CircuitNode
class SmoothNode : public CircuitNode class SmoothNode : public CircuitNode {
{
public: public:
SmoothNode (const Clauses& clauses, const LiftedWCNF& lwcnf) SmoothNode (const Clauses& clauses, const LiftedWCNF& lwcnf)
: CircuitNode(), clauses_(clauses), lwcnf_(lwcnf) { } : CircuitNode(), clauses_(clauses), lwcnf_(lwcnf) { }
@ -190,8 +182,7 @@ class SmoothNode : public CircuitNode
class TrueNode : public CircuitNode class TrueNode : public CircuitNode {
{
public: public:
TrueNode (void) : CircuitNode() { } TrueNode (void) : CircuitNode() { }
@ -200,8 +191,7 @@ class TrueNode : public CircuitNode
class CompilationFailedNode : public CircuitNode class CompilationFailedNode : public CircuitNode {
{
public: public:
CompilationFailedNode (void) : CircuitNode() { } CompilationFailedNode (void) : CircuitNode() { }
@ -210,8 +200,7 @@ class CompilationFailedNode : public CircuitNode
class LiftedCircuit class LiftedCircuit {
{
public: public:
LiftedCircuit (const LiftedWCNF* lwcnf); LiftedCircuit (const LiftedWCNF* lwcnf);
@ -285,8 +274,7 @@ class LiftedCircuit
class LiftedKc : public LiftedSolver class LiftedKc : public LiftedSolver {
{
public: public:
LiftedKc (const ParfactorList& pfList) LiftedKc (const ParfactorList& pfList)
: LiftedSolver(pfList) { } : LiftedSolver(pfList) { }

View File

@ -6,8 +6,7 @@
namespace Horus { namespace Horus {
class LiftedOperations class LiftedOperations {
{
public: public:
static void shatterAgainstQuery ( static void shatterAgainstQuery (
ParfactorList& pfList, const Grounds& query); ParfactorList& pfList, const Grounds& query);

View File

@ -6,8 +6,7 @@
namespace Horus { namespace Horus {
class LiftedSolver class LiftedSolver {
{
public: public:
LiftedSolver (const ParfactorList& pfList) LiftedSolver (const ParfactorList& pfList)
: parfactorList(pfList) { } : parfactorList(pfList) { }

View File

@ -12,8 +12,7 @@
namespace Horus { namespace Horus {
class Symbol class Symbol {
{
public: public:
Symbol (void) : id_(Util::maxUnsigned()) { } Symbol (void) : id_(Util::maxUnsigned()) { }
@ -32,8 +31,7 @@ class Symbol
}; };
class LogVar class LogVar {
{
public: public:
LogVar (void) : id_(Util::maxUnsigned()) { } LogVar (void) : id_(Util::maxUnsigned()) { }
@ -111,8 +109,7 @@ void printSymbolDictionary (void);
class Ground class Ground {
{
public: public:
Ground (Symbol f) : functor_(f) { } Ground (Symbol f) : functor_(f) { }
@ -138,8 +135,7 @@ typedef std::vector<Ground> Grounds;
class Substitution class Substitution {
{
public: public:
void add (LogVar X_old, LogVar X_new); void add (LogVar X_old, LogVar X_new);

View File

@ -10,8 +10,7 @@
namespace Horus { namespace Horus {
class LiftedOperator class LiftedOperator {
{
public: public:
virtual ~LiftedOperator (void) { } virtual ~LiftedOperator (void) { }
@ -35,8 +34,7 @@ class LiftedOperator
class ProductOperator : public LiftedOperator class ProductOperator : public LiftedOperator {
{
public: public:
ProductOperator ( ProductOperator (
ParfactorList::iterator g1, ParfactorList::iterator g2, ParfactorList::iterator g1, ParfactorList::iterator g2,
@ -62,8 +60,7 @@ class ProductOperator : public LiftedOperator
class SumOutOperator : public LiftedOperator class SumOutOperator : public LiftedOperator {
{
public: public:
SumOutOperator (PrvGroup group, ParfactorList& pfList) SumOutOperator (PrvGroup group, ParfactorList& pfList)
: group_(group), pfList_(pfList) { } : group_(group), pfList_(pfList) { }
@ -90,8 +87,7 @@ class SumOutOperator : public LiftedOperator
class CountingOperator : public LiftedOperator class CountingOperator : public LiftedOperator {
{
public: public:
CountingOperator ( CountingOperator (
ParfactorList::iterator pfIter, ParfactorList::iterator pfIter,
@ -119,8 +115,7 @@ class CountingOperator : public LiftedOperator
class GroundOperator : public LiftedOperator class GroundOperator : public LiftedOperator {
{
public: public:
GroundOperator ( GroundOperator (
PrvGroup group, PrvGroup group,
@ -148,8 +143,7 @@ class GroundOperator : public LiftedOperator
class LiftedVe : public LiftedSolver class LiftedVe : public LiftedSolver {
{
public: public:
LiftedVe (const ParfactorList& pfList) LiftedVe (const ParfactorList& pfList)
: LiftedSolver(pfList) { } : LiftedSolver(pfList) { }

View File

@ -15,14 +15,17 @@ namespace Horus {
class ParfactorList; class ParfactorList;
enum LogVarType { FULL_LV, POS_LV, NEG_LV }; enum LogVarType {
FULL_LV,
POS_LV,
NEG_LV
};
typedef long LiteralId; typedef long LiteralId;
typedef std::vector<LogVarType> LogVarTypes; typedef std::vector<LogVarType> LogVarTypes;
class Literal class Literal {
{
public: public:
Literal (LiteralId lid, const LogVars& lvs) Literal (LiteralId lid, const LogVars& lvs)
: lid_(lid), logVars_(lvs), negated_(false) { } : lid_(lid), logVars_(lvs), negated_(false) { }
@ -65,8 +68,7 @@ typedef std::vector<Literal> Literals;
class Clause class Clause {
{
public: public:
Clause (const ConstraintTree& ct = ConstraintTree({})) : constr_(ct) { } Clause (const ConstraintTree& ct = ConstraintTree({})) : constr_(ct) { }
@ -160,8 +162,7 @@ typedef std::vector<Clause*> Clauses;
class LitLvTypes class LitLvTypes {
{
public: public:
LitLvTypes (LiteralId lid, const LogVarTypes& lvTypes) : LitLvTypes (LiteralId lid, const LogVarTypes& lvTypes) :
lid_(lid), lvTypes_(lvTypes) { } lid_(lid), lvTypes_(lvTypes) { }
@ -201,8 +202,7 @@ typedef TinySet<LitLvTypes, CmpLitLvTypes> LitLvTypesSet;
class LiftedWCNF class LiftedWCNF {
{
public: public:
LiftedWCNF (const ParfactorList& pfList); LiftedWCNF (const ParfactorList& pfList);

View File

@ -13,8 +13,7 @@
namespace Horus { namespace Horus {
class Parfactor : public TFactor<ProbFormula> class Parfactor : public TFactor<ProbFormula> {
{
public: public:
Parfactor ( Parfactor (
const ProbFormulas&, const ProbFormulas&,

View File

@ -12,8 +12,7 @@ namespace Horus {
class Parfactor; class Parfactor;
class ParfactorList class ParfactorList {
{
public: public:
ParfactorList (void) { } ParfactorList (void) { }
@ -103,8 +102,7 @@ class ParfactorList
const ProbFormula&, ConstraintTree, const ProbFormula&, ConstraintTree,
const ProbFormula&, ConstraintTree) const; const ProbFormula&, ConstraintTree) const;
struct sortByParams struct sortByParams {
{
bool operator() (const Parfactor* pf1, const Parfactor* pf2) bool operator() (const Parfactor* pf1, const Parfactor* pf2)
{ {
if (pf1->params().size() < pf2->params().size()) { if (pf1->params().size() < pf2->params().size()) {

View File

@ -14,8 +14,7 @@ namespace Horus {
typedef unsigned long PrvGroup; typedef unsigned long PrvGroup;
class ProbFormula class ProbFormula {
{
public: public:
ProbFormula (Symbol f, const LogVars& lvs, unsigned range) ProbFormula (Symbol f, const LogVars& lvs, unsigned range)
: functor_(f), logVars_(lvs), range_(range), : functor_(f), logVars_(lvs), range_(range),
@ -81,8 +80,7 @@ class ProbFormula
typedef std::vector<ProbFormula> ProbFormulas; typedef std::vector<ProbFormula> ProbFormulas;
class ObservedFormula class ObservedFormula {
{
public: public:
ObservedFormula (Symbol f, unsigned a, unsigned ev); ObservedFormula (Symbol f, unsigned a, unsigned ev);

View File

@ -9,8 +9,7 @@
namespace Horus { namespace Horus {
template <typename T, typename Compare = std::less<T>> template <typename T, typename Compare = std::less<T>>
class TinySet class TinySet {
{
public: public:
typedef typename std::vector<T>::iterator iterator; typedef typename std::vector<T>::iterator iterator;
typedef typename std::vector<T>::const_iterator const_iterator; typedef typename std::vector<T>::const_iterator const_iterator;

View File

@ -12,8 +12,7 @@
namespace Horus { namespace Horus {
struct VarInfo struct VarInfo {
{
VarInfo (std::string l, const States& sts) VarInfo (std::string l, const States& sts)
: label(l), states(sts) { } : label(l), states(sts) { }
std::string label; std::string label;
@ -21,8 +20,7 @@ struct VarInfo
}; };
class Var class Var {
{
public: public:
Var (const Var*); Var (const Var*);

View File

@ -11,8 +11,7 @@
namespace Horus { namespace Horus {
class VarElim : public GroundSolver class VarElim : public GroundSolver {
{
public: public:
VarElim (const FactorGraph& fg) : GroundSolver (fg) { } VarElim (const FactorGraph& fg) : GroundSolver (fg) { }

View File

@ -8,8 +8,7 @@
namespace Horus { namespace Horus {
class WeightedLink : public BpLink class WeightedLink : public BpLink {
{
public: public:
WeightedLink (FacNode* fn, VarNode* vn, size_t idx, unsigned weight) WeightedLink (FacNode* fn, VarNode* vn, size_t idx, unsigned weight)
: BpLink (fn, vn), index_(idx), weight_(weight), : BpLink (fn, vn), index_(idx), weight_(weight),
@ -43,8 +42,7 @@ WeightedLink::updateMessage (void)
class WeightedBp : public BeliefProp class WeightedBp : public BeliefProp {
{
public: public:
WeightedBp (const FactorGraph& fg, WeightedBp (const FactorGraph& fg,
const std::vector<std::vector<unsigned>>& weights) const std::vector<std::vector<unsigned>>& weights)