[Rsiena-commits] r226 - in pkg/RSienaTest/src/model: effects/generic filters

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Wed Apr 17 07:18:23 CEST 2013


Author: ortmann
Date: 2013-04-17 07:18:22 +0200 (Wed, 17 Apr 2013)
New Revision: 226

Modified:
   pkg/RSienaTest/src/model/effects/generic/AlterPredicate.h
   pkg/RSienaTest/src/model/effects/generic/CovariatePredicate.h
   pkg/RSienaTest/src/model/filters/PermittedChangeFilter.h
Log:
changes:
	base classes have always a virtual destructor
	reduced visibility of abstract class constructors

Modified: pkg/RSienaTest/src/model/effects/generic/AlterPredicate.h
===================================================================
--- pkg/RSienaTest/src/model/effects/generic/AlterPredicate.h	2013-03-12 20:49:44 UTC (rev 225)
+++ pkg/RSienaTest/src/model/effects/generic/AlterPredicate.h	2013-04-17 05:18:22 UTC (rev 226)
@@ -11,8 +11,7 @@
 #ifndef ALTERPREDICATE_H_
 #define ALTERPREDICATE_H_
 
-namespace siena
-{
+namespace siena {
 
 // ----------------------------------------------------------------------------
 // Section: Forward declarations
@@ -22,7 +21,6 @@
 class State;
 class Cache;
 
-
 // ----------------------------------------------------------------------------
 // Section: Class definition
 // ----------------------------------------------------------------------------
@@ -30,15 +28,11 @@
 /**
  * Defines a predicate on all actors (alters) with respect to a given ego.
  */
-class AlterPredicate
-{
+class AlterPredicate {
 public:
-	AlterPredicate();
-
-	virtual void initialize(const Data * pData,
-		State * pState,
-		int period,
-		Cache * pCache);
+	virtual ~AlterPredicate() {}
+	virtual void initialize(const Data * pData, State * pState, int period,
+			Cache * pCache);
 	virtual void preprocessEgo(int ego);
 
 	inline int ego() const;
@@ -51,12 +45,14 @@
 	 */
 	virtual bool value(int alter) = 0;
 
+protected:
+	AlterPredicate();
+
 private:
 	int lego;
 	int lperiod;
 };
 
-
 // ----------------------------------------------------------------------------
 // Section: Inline methods
 // ----------------------------------------------------------------------------
@@ -64,17 +60,14 @@
 /**
  * Returns the current ego.
  */
-int AlterPredicate::ego() const
-{
+int AlterPredicate::ego() const {
 	return this->lego;
 }
 
-
 /**
  * Returns the period of interest.
  */
-int AlterPredicate::period() const
-{
+int AlterPredicate::period() const {
 	return this->lperiod;
 }
 

Modified: pkg/RSienaTest/src/model/effects/generic/CovariatePredicate.h
===================================================================
--- pkg/RSienaTest/src/model/effects/generic/CovariatePredicate.h	2013-03-12 20:49:44 UTC (rev 225)
+++ pkg/RSienaTest/src/model/effects/generic/CovariatePredicate.h	2013-04-17 05:18:22 UTC (rev 226)
@@ -4,8 +4,7 @@
 #include "AlterPredicate.h"
 #include "utils/NamedObject.h"
 
-namespace siena
-{
+namespace siena {
 
 // ----------------------------------------------------------------------------
 // Section: Forward declarations
@@ -15,7 +14,6 @@
 class ChangingCovariate;
 class BehaviorLongitudinalData;
 
-
 // ----------------------------------------------------------------------------
 // Section: Class definition
 // ----------------------------------------------------------------------------
@@ -24,16 +22,13 @@
  * Defines an alter predicate that depends on a certain covariate or
  * behavior variable.
  */
-class CovariatePredicate: public AlterPredicate, NamedObject
-{
+class CovariatePredicate: public AlterPredicate, NamedObject {
 public:
 	CovariatePredicate(string covariateName);
+	virtual ~CovariatePredicate() {}
+	virtual void initialize(const Data * pData, State * pState, int period,
+			Cache * pCache);
 
-	virtual void initialize(const Data * pData,
-		State * pState,
-		int period,
-		Cache * pCache);
-
 protected:
 	double covariateValue(int i) const;
 	bool missing(int i) const;

Modified: pkg/RSienaTest/src/model/filters/PermittedChangeFilter.h
===================================================================
--- pkg/RSienaTest/src/model/filters/PermittedChangeFilter.h	2013-03-12 20:49:44 UTC (rev 225)
+++ pkg/RSienaTest/src/model/filters/PermittedChangeFilter.h	2013-04-17 05:18:22 UTC (rev 226)
@@ -34,8 +34,7 @@
 class PermittedChangeFilter
 {
 public:
-	PermittedChangeFilter(const NetworkVariable * pVariable);
-
+	virtual ~PermittedChangeFilter(){}
 	/**
 	 * Forbids tie changes between the given ego and some alters
 	 * by setting the permitted flag to false for these alters.
@@ -49,6 +48,7 @@
 	virtual bool validMiniStep(const NetworkChange * pMiniStep) = 0;
 
 protected:
+	PermittedChangeFilter(const NetworkVariable * pVariable);
 	inline const NetworkVariable * pVariable() const;
 
 private:



More information about the Rsiena-commits mailing list