Skip to content
Snippets Groups Projects
Commit a2c08257 authored by Ramin Yaghoubzadeh's avatar Ramin Yaghoubzadeh
Browse files

Bug fixes in C++

Implemented retraction handler. Replaced deprecated converter repository call.
parent 744d490a
No related branches found
No related tags found
No related merge requests found
......@@ -3,7 +3,7 @@
<import file="../../../hmibuild/build.xml" />
<target name="check-proto-files">
<echo message="Checking whether compiled protobuf files are already present..." />
<available file="build/ipaaca.pb.h" property="pb.present"/>
<available file="build/ipaaca/ipaaca.pb.h" property="pb.present"/>
</target>
<target name="-proto-yes" depends="check-proto-files" if="pb.present">
<echo message="Built protobuf files found, skipping compilation" />
......
......@@ -241,6 +241,14 @@ class CallbackIUCommission: public rsb::patterns::Server::Callback<protobuf::IUC
public:
boost::shared_ptr<int> call(const std::string& methodName, boost::shared_ptr<protobuf::IUCommission> update);
};
class CallbackIURetraction: public rsb::patterns::Server::Callback<protobuf::IURetraction, int> {
protected:
Buffer* _buffer;
public:
CallbackIURetraction(Buffer* buffer);
public:
boost::shared_ptr<int> call(const std::string& methodName, boost::shared_ptr<protobuf::IURetraction> update);
};
class OutputBuffer: public Buffer { //, public boost::enable_shared_from_this<OutputBuffer> {//{{{
friend class IU;
......@@ -451,6 +459,7 @@ class IUInterface {//{{{
std::string _payload_type; // default is "MAP"
std::string _owner_name;
bool _committed;
bool _retracted;
IUAccessMode _access_mode;
bool _read_only;
//boost::shared_ptr<Buffer> _buffer;
......@@ -556,6 +565,7 @@ class RemotePushIU: public IUInterface {//{{{
void _apply_update(IUPayloadUpdate::ptr update);
void _apply_link_update(IULinkUpdate::ptr update);
void _apply_commission();
void _apply_retraction();
typedef boost::shared_ptr<RemotePushIU> ptr;
};//}}}
......
......@@ -22,19 +22,22 @@ void Initializer::initialize_ipaaca_rsb_if_needed()
Factory::getInstance().setDefaultParticipantConfig(config);
boost::shared_ptr<IUConverter> iu_converter(new IUConverter());
stringConverterRepository()->registerConverter(iu_converter);
converterRepository<std::string>()->registerConverter(iu_converter);
boost::shared_ptr<IUPayloadUpdateConverter> payload_update_converter(new IUPayloadUpdateConverter());
stringConverterRepository()->registerConverter(payload_update_converter);
converterRepository<std::string>()->registerConverter(payload_update_converter);
boost::shared_ptr<IULinkUpdateConverter> link_update_converter(new IULinkUpdateConverter());
stringConverterRepository()->registerConverter(link_update_converter);
converterRepository<std::string>()->registerConverter(link_update_converter);
boost::shared_ptr<ProtocolBufferConverter<protobuf::IUCommission> > iu_commission_converter(new ProtocolBufferConverter<protobuf::IUCommission> ());
stringConverterRepository()->registerConverter(iu_commission_converter);
converterRepository<std::string>()->registerConverter(iu_commission_converter);
boost::shared_ptr<ProtocolBufferConverter<protobuf::IURetraction> > iu_retraction_converter(new ProtocolBufferConverter<protobuf::IURetraction> ());
converterRepository<std::string>()->registerConverter(iu_retraction_converter);
boost::shared_ptr<IntConverter> int_converter(new IntConverter());
stringConverterRepository()->registerConverter(int_converter);
converterRepository<std::string>()->registerConverter(int_converter);
_initialized = true;
//IPAACA_TODO("initialize all converters")
......@@ -666,6 +669,21 @@ void InputBuffer::_handle_iu_events(EventPtr event)
call_iu_event_handlers(it->second, false, IU_COMMITTED, it->second->category() );
//
//
} else if (type == "ipaaca::protobuf::IURetraction") {
boost::shared_ptr<protobuf::IURetraction> update = boost::static_pointer_cast<protobuf::IURetraction>(event->getData());
it = _iu_store.find(update->uid());
if (it == _iu_store.end()) {
IPAACA_INFO("Ignoring RETRACTED message for an IU that we did not fully receive before")
return;
}
//
it->second->_revision = update->revision();
it->second->_apply_retraction();
// remove from InputBuffer FIXME: this is a crossover between retracted and deleted behavior
_iu_store.erase(it->first);
// and call the handler. IU reference is still valid for this call, although removed from buffer.
call_iu_event_handlers(it->second, false, IU_COMMITTED, it->second->category() );
//
} else {
std::cout << "(Unhandled Event type " << type << " !)" << std::endl;
return;
......@@ -681,7 +699,7 @@ void InputBuffer::_handle_iu_events(EventPtr event)
// IUInterface//{{{
IUInterface::IUInterface()
: _buffer(NULL), _committed(false)
: _buffer(NULL), _committed(false), _retracted(false)
{
}
......@@ -945,6 +963,10 @@ void RemotePushIU::_apply_commission()
{
_committed = true;
}
void RemotePushIU::_apply_retraction()
{
_retracted = true;
}
void Payload::_remotely_enforced_wipe()
{
_store.clear();
......
......@@ -6,5 +6,5 @@ Specification-Title: IpaacaJava
Specification-Version: 0.1
Specification-Vendor: ipaaca
Implementation-Title: IpaacaJava
Implementation-Version: August 02 2012 01:27 PM
Implementation-Version: August 08 2012 11:03 AM
Implementation-Vendor: ipaaca
\ No newline at end of file
<ivy-module version="2.0">
<info organisation="ipaaca" module="IpaacaPython" />
<publications>
<artifact type="zip" ext="zip"/>
<artifact type="zip" ext="zip"/>
</publications>
<dependencies>
<dependency org="google" name="protobuf" rev="latest.release"/>
<dependency org="rsb" name="rsb" rev="latest.release"/>
<!-- dependency org="google" name="protobuf" rev="latest.release"/ -->
<!-- dependency org="rsb" name="rsb" rev="latest.release"/ -->
</dependencies>
</ivy-module>
......@@ -6,10 +6,12 @@ mkdir -p deps/bin
mkdir -p deps/lib
mkdir -p deps/include
mkdir -p deps/scripts
mkdir -p deps/python
for P in $PACKAGES; do
cp -a ../$P/dist/bin/* deps/bin/
cp -a ../$P/dist/lib/* deps/lib/
cp -a ../$P/dist/include/* deps/include/
cp -a ../$P/dist/scripts/* deps/scripts/
cp -a ../$P/dist/python/* deps/python/
done
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment