10 #include <gvarprop.hpp>
11 #include <gnotifier.hpp>
12 #include <gwrapper.hpp>
18 inline void gunbind(GVarProp& prop1, GVarProp& prop2) {prop1.unbind(prop2);}
25 inline void gunbind(GVarProp& prop, GVarProp::BindTag tag = 0) {prop.unbind(tag);}
51 template <
class R,
class RM =
typename R::IsVarProp,
class S,
class SM =
typename S::IsVarProp>
52 inline R& gbind(R& prop1, S& prop2, GVarProp::BindTag tag = 0) {
53 prop1.bindImpl(prop2, *
new GChangePropNotifier<S,R>(prop2,prop1), tag,
false);
57 template <
class R,
class RM =
typename R::IsVarProp,
class S,
class SM =
typename S::IsVarProp>
58 inline R& operator<<=(R& prop1, S& prop2) {
return gbind(prop1, prop2);}
60 template <
class R,
class RM =
typename R::IsVarProp,
class S>
61 inline R& operator<<=(R& prop1, GPropRef_<S> prop2) {
return gbind(prop1, (S&)prop2.prop_);}
76 template <
class R,
class S,
class F,
class MATCH =
typename R::IsVarProp>
77 inline R& gbind(R& prop, GPropField<S,F>
const& field) {
78 using RVal =
typename R::ValueType;
79 prop.bindImpl(field.prop_,
80 *
new GChangeFieldNotifier<S,F,R,RVal>(field, GPropField<R,RVal>(prop,prop.value_)),
85 template <
class R,
class F,
class S>
86 inline R& gbind(GPropField<R,F>
const& field, GVarProp_<S>& prop) {
87 field.prop_.bindImpl(prop, *
new GChangeFieldNotifier<GVarProp_<S>,S,R,F>
88 (GPropField<GVarProp_<S>,F>(prop,prop.value_), field), 0,
false);
92 template <
class R,
class S,
class F,
class MATCH =
typename R::IsVarProp>
93 inline R& operator<<=(R& prop, GPropField<S,F>
const& field) {
return gbind(prop,field);}
95 template <
class R,
class F,
class S>
96 inline R& operator<<=(GPropField<R,F>
const& field, GVarProp_<S>& prop) {
return gbind(field,prop);}
110 template <
class R,
class RF,
class S,
class SF>
111 inline R& gbind(GPropField<R,RF>
const& field1, GPropField<S,SF>
const& field2) {
112 field1.prop_.bindImpl(field2.prop_,
113 *
new GChangeFieldNotifier<S,SF,R,RF>(field2,field1),
118 template <
class R,
class RF,
class S,
class SF>
119 inline R& operator<<=(GPropField<R,RF>
const& field1, GPropField<S,SF>
const& field2) {
120 return gbind(field1, field2);
140 template <
class R,
class RM =
typename R::IsVarProp,
141 class S,
class SM =
typename S::IsVarProp>
142 inline R& gsync(R& prop1, S& prop2, GVarProp::BindTag tag = 0) {
143 prop1.bindImpl(prop2, *
new GChangePropNotifier<S,R>(prop2,prop1), tag,
false);
144 prop2.bindImpl(prop1, *
new GChangePropNotifier<R,S>(prop1,prop2), tag,
true);
147 template <
class R,
class RM =
typename R::IsVarProp,
148 class S,
class SM =
typename S::IsVarProp>
149 inline R& operator^=(R& prop1, S& prop2) {
return gsync(prop1, prop2);}
163 template <
class R,
class S,
class F,
class MATCH =
typename R::IsVarProp>
164 inline R& gsync(R& prop, GPropField<S,F>
const& field) {
165 using RVal =
typename R::ValueType;
166 gbind<R,S,F>(prop, field);
167 field.prop_.bindImpl(prop, *
new GChangeFieldNotifier<R,RVal,S,F>
168 (GPropField<R,RVal>(prop,prop.value_), field), 0,
false);
172 template <
class R,
class F,
class S>
173 inline R& gsync(GPropField<R,F>
const& field, GVarProp_<S>& prop) {
175 prop.bindImpl(field.prop_, *
new GChangeFieldNotifier<R,F,GVarProp_<S>,S>
176 (field, GPropField<GVarProp_<S>,S>(prop,prop.value_)), 0,
false);
180 template <
class R,
class S,
class F,
class MATCH =
typename R::IsVarProp>
181 inline R& operator^=(R& prop, GPropField<S,F>
const& field) {
182 return gsync<R,S,F>(prop, field);
185 template <
class R,
class F,
class S>
186 inline R& operator^=(GPropField<R,F>
const& field, GVarProp_<S>& prop) {
187 return gsync<R,F,S>(field,prop);
202 template <
class R,
class RF,
class S,
class SF>
203 inline R& gsync(GPropField<R,RF>
const& field1, GPropField<S,SF>
const& field2) {
204 gbind(field1, field2);
205 gbind(field2, field1);
209 template <
class R,
class RF,
class S,
class SF>
210 inline R& operator^=(GPropField<R,RF>
const& field1, GPropField<S,SF>
const& field2) {
211 return gsync(field1, field2);