@@ -147,6 +147,7 @@ namespace Gecode {
147147 class ViewTraceInfo ;
148148 class PropagateTraceInfo ;
149149 class CommitTraceInfo ;
150+ class PostTraceInfo ;
150151 class TraceRecorder ;
151152 class TraceFilter ;
152153 class Tracer ;
@@ -676,6 +677,7 @@ namespace Gecode {
676677 friend class ViewTraceInfo ;
677678 friend class PropagateTraceInfo ;
678679 friend class CommitTraceInfo ;
680+ friend class PostTraceInfo ;
679681 protected:
680682 // / Fake id for group of all actors
681683 static const unsigned int GROUPID_ALL = 0U ;
@@ -726,6 +728,7 @@ namespace Gecode {
726728 friend class Propagator ;
727729 friend class ViewTraceInfo ;
728730 friend class PropagateTraceInfo ;
731+ friend class PostTraceInfo ;
729732 protected:
730733 // / Initialize with group id \a gid
731734 PropagatorGroup (unsigned int gid);
@@ -943,9 +946,14 @@ namespace Gecode {
943946 * \brief Class to set group information when a post function is executed
944947 */
945948 class PostInfo {
949+ friend class Space ;
946950 protected:
947951 // / The home space
948952 Space& h;
953+ // / The propagator group
954+ PropagatorGroup pg;
955+ // / Next free propagator id
956+ unsigned int pid;
949957 public:
950958 // / Set information
951959 PostInfo (Home home);
@@ -1016,6 +1024,37 @@ namespace Gecode {
10161024 unsigned int alternative (void ) const ;
10171025 };
10181026
1027+ /* *
1028+ * \brief Post trace information
1029+ */
1030+ class PostTraceInfo {
1031+ friend class Space ;
1032+ friend class PostInfo ;
1033+ public:
1034+ // / Post status
1035+ enum Status {
1036+ POSTED, // /< Propagator was posted
1037+ FAILED, // /< Posting failed
1038+ SUBSUMED // /< Propagator not posted as already subsumed
1039+ };
1040+ protected:
1041+ // / Propagator group
1042+ PropagatorGroup g;
1043+ // / Status
1044+ Status s;
1045+ // / Number of posted propagators
1046+ unsigned int n;
1047+ // / Initialize
1048+ PostTraceInfo (PropagatorGroup g, Status s, unsigned int n);
1049+ public:
1050+ // / Return post status
1051+ Status status (void ) const ;
1052+ // / Return propagator group
1053+ PropagatorGroup group (void ) const ;
1054+ // / Return number of posted propagators
1055+ unsigned int propagators (void ) const ;
1056+ };
1057+
10191058 /* *
10201059 * \brief Base-class for propagators
10211060 * \ingroup TaskActor
@@ -1931,6 +1970,9 @@ namespace Gecode {
19311970 // / Find trace recorder if exists
19321971 GECODE_KERNEL_EXPORT
19331972 TraceRecorder* findtracerecorder (void );
1973+ // / Trace posting event
1974+ GECODE_KERNEL_EXPORT
1975+ void post (const PostInfo& pi);
19341976
19351977 /* *
19361978 * \brief Notice that an actor must be disposed
@@ -1948,7 +1990,6 @@ namespace Gecode {
19481990 */
19491991 GECODE_KERNEL_EXPORT
19501992 void ap_ignore_dispose (Actor* a, bool d);
1951-
19521993 public:
19531994 /* *
19541995 * \brief Default constructor
@@ -3310,14 +3351,20 @@ namespace Gecode {
33103351 * Post information
33113352 */
33123353 forceinline
3313- PostInfo::PostInfo (Home home) : h(home) {
3314- h.pc .p .vti .post (home.propagatorgroup ());
3354+ PostInfo::PostInfo (Home home)
3355+ : h(home), pg(home.propagatorgroup()), pid(h.ssd.data().gpi.pid()) {
3356+ assert (!home.failed ());
3357+ h.pc .p .vti .post (pg);
33153358 }
3359+
33163360 forceinline
33173361 PostInfo::~PostInfo (void ) {
3362+ if (h.pc .p .bid_sc & Space::sc_trace)
3363+ h.post (*this );
33183364 h.pc .p .vti .other ();
33193365 }
33203366
3367+
33213368 /*
33223369 * Propagate trace information
33233370 *
@@ -3374,6 +3421,27 @@ namespace Gecode {
33743421 }
33753422
33763423
3424+ /*
3425+ * Post trace information
3426+ *
3427+ */
3428+ forceinline
3429+ PostTraceInfo::PostTraceInfo (PropagatorGroup g0, Status s0, unsigned int n0)
3430+ : g(g0), s(s0), n(n0) {}
3431+ forceinline PropagatorGroup
3432+ PostTraceInfo::group (void ) const {
3433+ return g;
3434+ }
3435+ forceinline PostTraceInfo::Status
3436+ PostTraceInfo::status (void ) const {
3437+ return s;
3438+ }
3439+ forceinline unsigned int
3440+ PostTraceInfo::propagators (void ) const {
3441+ return n;
3442+ }
3443+
3444+
33773445 /*
33783446 * Propagator
33793447 *
@@ -3955,12 +4023,12 @@ namespace Gecode {
39554023
39564024 forceinline void
39574025 Space::fail (void ) {
4026+ pc.p .active = &pc.p .queue [PropCost::AC_MAX+1 ]+1 ;
39584027 /*
39594028 * Now active points beyond the last queue. This is essential as
39604029 * enqueuing a propagator in a failed space keeps the space
39614030 * failed.
39624031 */
3963- pc.p .active = &pc.p .queue [PropCost::AC_MAX+1 ]+1 ;
39644032 }
39654033 forceinline void
39664034 Home::fail (void ) {
0 commit comments