Skip to content
This repository has been archived by the owner on Sep 1, 2022. It is now read-only.

Commit

Permalink
tweaked astyle and formatted codebase
Browse files Browse the repository at this point in the history
  • Loading branch information
jadamcrain committed Mar 9, 2014
1 parent 5dfb3c0 commit 0be4a14
Show file tree
Hide file tree
Showing 517 changed files with 10,349 additions and 8,457 deletions.
22 changes: 11 additions & 11 deletions clr/DNP3CLRAdapter/ChannelAdapter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,48 +23,48 @@ ChannelAdapter::ChannelAdapter(opendnp3::IChannel* apChannel) :

}

void ChannelAdapter::AddStateListener(System::Action<ChannelState> ^ listener)
void ChannelAdapter::AddStateListener(System::Action<ChannelState>^ listener)
{
auto pWrapper = new gcroot < System::Action<ChannelState> ^ > (listener);
mpChannel->AddDestructorHook(std::bind(&DeleteAnything < gcroot < System::Action<ChannelState> ^ >> , pWrapper));
mpChannel->AddStateListener(std::bind(&CallbackListener, pWrapper, std::placeholders::_1));
}

void CallbackListener(gcroot < System::Action<ChannelState> ^ > * listener, opendnp3::ChannelState aState)
void CallbackListener(gcroot < System::Action<ChannelState> ^ >* listener, opendnp3::ChannelState aState)
{
ChannelState state = Conversions::convertChannelState(aState);
(*listener)->Invoke(state);
}

IMaster ^ ChannelAdapter::AddMaster(System::String ^ loggerId, DNP3::Interface::LogLevel level, ISOEHandler ^ publisher, MasterStackConfig ^ config)
IMaster^ ChannelAdapter::AddMaster(System::String^ loggerId, DNP3::Interface::LogLevel level, ISOEHandler^ publisher, MasterStackConfig^ config)
{
std::string stdLoggerId = Conversions::convertString(loggerId);
openpal::LogLevel stdLevel = Conversions::convertLogLevel(level);

MasterMeasurementHandlerWrapper ^ wrapper = gcnew MasterMeasurementHandlerWrapper(publisher);
MasterMeasurementHandlerWrapper^ wrapper = gcnew MasterMeasurementHandlerWrapper(publisher);
opendnp3::MasterStackConfig cfg = Conversions::convertConfig(config);
auto pMaster = mpChannel->AddMaster(stdLoggerId, stdLevel, wrapper->Get(), asiopal::UTCTimeSource::Inst(), cfg); // TODO expose time source

auto pMaster = mpChannel->AddMaster(stdLoggerId, stdLevel, wrapper->Get(), asiopal::UTCTimeSource::Inst(), cfg); // TODO expose time source
if (pMaster == nullptr)
{
return nullptr;
}
else
{
return gcnew MasterAdapter(pMaster);
}
}
}

IOutstation ^ ChannelAdapter::AddOutstation(System::String ^ loggerId, DNP3::Interface::LogLevel level, ICommandHandler ^ cmdHandler, ITimeWriteHandler ^ timeHandler, SlaveStackConfig ^ config)
IOutstation^ ChannelAdapter::AddOutstation(System::String^ loggerId, DNP3::Interface::LogLevel level, ICommandHandler^ cmdHandler, ITimeWriteHandler^ timeHandler, SlaveStackConfig^ config)
{
std::string stdLoggerId = Conversions::convertString(loggerId);
openpal::LogLevel stdLevel = Conversions::convertLogLevel(level);

SlaveCommandHandlerWrapper ^ cmdWrapper = gcnew SlaveCommandHandlerWrapper(cmdHandler);
OutstationTimeWriteWrapper ^ timeWrapper = gcnew OutstationTimeWriteWrapper(timeHandler);
SlaveCommandHandlerWrapper^ cmdWrapper = gcnew SlaveCommandHandlerWrapper(cmdHandler);
OutstationTimeWriteWrapper^ timeWrapper = gcnew OutstationTimeWriteWrapper(timeHandler);

opendnp3::SlaveStackConfig cfg = Conversions::convertConfig(config);

auto pOutstation = mpChannel->AddOutstation(stdLoggerId, stdLevel, cmdWrapper->Get(), timeWrapper->Get(), Conversions::convertConfig(config));
if (pOutstation == nullptr)
{
Expand Down
8 changes: 4 additions & 4 deletions clr/DNP3CLRAdapter/ChannelAdapter.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,19 @@ namespace DNP3
{
namespace Adapter
{
void CallbackListener(gcroot < System::Action<ChannelState> ^ > * listener, opendnp3::ChannelState);
void CallbackListener(gcroot < System::Action<ChannelState> ^ >* listener, opendnp3::ChannelState);

private ref class ChannelAdapter : IChannel
{
public:

ChannelAdapter(opendnp3::IChannel* apChannel);

virtual void AddStateListener(System::Action<ChannelState> ^ listener);
virtual void AddStateListener(System::Action<ChannelState>^ listener);

virtual IMaster ^ AddMaster(System::String ^ loggerId, DNP3::Interface::LogLevel level, ISOEHandler ^ publisher, MasterStackConfig ^ config);
virtual IMaster^ AddMaster(System::String^ loggerId, DNP3::Interface::LogLevel level, ISOEHandler^ publisher, MasterStackConfig^ config);

virtual IOutstation ^ AddOutstation(System::String ^ loggerId, DNP3::Interface::LogLevel level, ICommandHandler ^ cmdHandler, ITimeWriteHandler ^ timeHandler, SlaveStackConfig ^ config);
virtual IOutstation^ AddOutstation(System::String^ loggerId, DNP3::Interface::LogLevel level, ICommandHandler^ cmdHandler, ITimeWriteHandler^ timeHandler, SlaveStackConfig^ config);

virtual void Shutdown();

Expand Down
22 changes: 11 additions & 11 deletions clr/DNP3CLRAdapter/CommandProcessorAdapter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ namespace DNP3
namespace Adapter
{

void ResponseRouter::Set(gcroot < Future<CommandResponse> ^ > * apFuture, opendnp3::CommandResponse cr)
void ResponseRouter::Set(gcroot < Future<CommandResponse> ^ >* apFuture, opendnp3::CommandResponse cr)
{
std::auto_ptr < gcroot < Future<CommandResponse> ^ >> ptr(apFuture);
(*apFuture)->Set(Conversions::convertCommandResponse(cr));
Expand All @@ -23,52 +23,52 @@ CommandProcessorAdapter::CommandProcessorAdapter(opendnp3::ICommandProcessor* ap

}

IFuture<CommandResponse> ^ CommandProcessorAdapter::SelectAndOperate(ControlRelayOutputBlock ^ command, System::UInt32 index)
IFuture<CommandResponse>^ CommandProcessorAdapter::SelectAndOperate(ControlRelayOutputBlock^ command, System::UInt32 index)
{
return this->SelectAndOperateT(command, index);
}

IFuture<CommandResponse> ^ CommandProcessorAdapter::SelectAndOperate(AnalogOutputInt32 ^ command, System::UInt32 index)
IFuture<CommandResponse>^ CommandProcessorAdapter::SelectAndOperate(AnalogOutputInt32^ command, System::UInt32 index)
{
return this->SelectAndOperateT(command, index);
}

IFuture<CommandResponse> ^ CommandProcessorAdapter::SelectAndOperate(AnalogOutputInt16 ^ command, System::UInt32 index)
IFuture<CommandResponse>^ CommandProcessorAdapter::SelectAndOperate(AnalogOutputInt16^ command, System::UInt32 index)
{
return this->SelectAndOperateT(command, index);
}

IFuture<CommandResponse> ^ CommandProcessorAdapter::SelectAndOperate(AnalogOutputFloat32 ^ command, System::UInt32 index)
IFuture<CommandResponse>^ CommandProcessorAdapter::SelectAndOperate(AnalogOutputFloat32^ command, System::UInt32 index)
{
return this->SelectAndOperateT(command, index);
}

IFuture<CommandResponse> ^ CommandProcessorAdapter::SelectAndOperate(AnalogOutputDouble64 ^ command, System::UInt32 index)
IFuture<CommandResponse>^ CommandProcessorAdapter::SelectAndOperate(AnalogOutputDouble64^ command, System::UInt32 index)
{
return this->SelectAndOperateT(command, index);
}

IFuture<CommandResponse> ^ CommandProcessorAdapter::DirectOperate(ControlRelayOutputBlock ^ command, System::UInt32 index)
IFuture<CommandResponse>^ CommandProcessorAdapter::DirectOperate(ControlRelayOutputBlock^ command, System::UInt32 index)
{
return this->DirectOperateT(command, index);
}

IFuture<CommandResponse> ^ CommandProcessorAdapter::DirectOperate(AnalogOutputInt32 ^ command, System::UInt32 index)
IFuture<CommandResponse>^ CommandProcessorAdapter::DirectOperate(AnalogOutputInt32^ command, System::UInt32 index)
{
return this->DirectOperateT(command, index);
}

IFuture<CommandResponse> ^ CommandProcessorAdapter::DirectOperate(AnalogOutputInt16 ^ command, System::UInt32 index)
IFuture<CommandResponse>^ CommandProcessorAdapter::DirectOperate(AnalogOutputInt16^ command, System::UInt32 index)
{
return this->DirectOperateT(command, index);
}

IFuture<CommandResponse> ^ CommandProcessorAdapter::DirectOperate(AnalogOutputFloat32 ^ command, System::UInt32 index)
IFuture<CommandResponse>^ CommandProcessorAdapter::DirectOperate(AnalogOutputFloat32^ command, System::UInt32 index)
{
return this->DirectOperateT(command, index);
}

IFuture<CommandResponse> ^ CommandProcessorAdapter::DirectOperate(AnalogOutputDouble64 ^ command, System::UInt32 index)
IFuture<CommandResponse>^ CommandProcessorAdapter::DirectOperate(AnalogOutputDouble64^ command, System::UInt32 index)
{
return this->DirectOperateT(command, index);
}
Expand Down
28 changes: 15 additions & 13 deletions clr/DNP3CLRAdapter/CommandProcessorAdapter.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ namespace Adapter
private class ResponseRouter
{
public:
static void Set(gcroot < Future<CommandResponse> ^ > * apFuture, opendnp3::CommandResponse cr);
static void Set(gcroot < Future<CommandResponse> ^ >* apFuture, opendnp3::CommandResponse cr);
};

private ref class CommandProcessorAdapter : public ICommandProcessor
Expand All @@ -26,22 +26,23 @@ private ref class CommandProcessorAdapter : public ICommandProcessor

CommandProcessorAdapter(opendnp3::ICommandProcessor* apProxy);

virtual IFuture<CommandResponse> ^ SelectAndOperate(ControlRelayOutputBlock ^ command, System::UInt32 index);
virtual IFuture<CommandResponse> ^ SelectAndOperate(AnalogOutputInt32 ^ command, System::UInt32 index);
virtual IFuture<CommandResponse> ^ SelectAndOperate(AnalogOutputInt16 ^ command, System::UInt32 index);
virtual IFuture<CommandResponse> ^ SelectAndOperate(AnalogOutputFloat32 ^ command, System::UInt32 index);
virtual IFuture<CommandResponse> ^ SelectAndOperate(AnalogOutputDouble64 ^ command, System::UInt32 index);
virtual IFuture<CommandResponse>^ SelectAndOperate(ControlRelayOutputBlock^ command, System::UInt32 index);
virtual IFuture<CommandResponse>^ SelectAndOperate(AnalogOutputInt32^ command, System::UInt32 index);
virtual IFuture<CommandResponse>^ SelectAndOperate(AnalogOutputInt16^ command, System::UInt32 index);
virtual IFuture<CommandResponse>^ SelectAndOperate(AnalogOutputFloat32^ command, System::UInt32 index);
virtual IFuture<CommandResponse>^ SelectAndOperate(AnalogOutputDouble64^ command, System::UInt32 index);

virtual IFuture<CommandResponse> ^ DirectOperate(ControlRelayOutputBlock ^ command, System::UInt32 index);
virtual IFuture<CommandResponse> ^ DirectOperate(AnalogOutputInt32 ^ command, System::UInt32 index);
virtual IFuture<CommandResponse> ^ DirectOperate(AnalogOutputInt16 ^ command, System::UInt32 index);
virtual IFuture<CommandResponse> ^ DirectOperate(AnalogOutputFloat32 ^ command, System::UInt32 index);
virtual IFuture<CommandResponse> ^ DirectOperate(AnalogOutputDouble64 ^ command, System::UInt32 index);
virtual IFuture<CommandResponse>^ DirectOperate(ControlRelayOutputBlock^ command, System::UInt32 index);
virtual IFuture<CommandResponse>^ DirectOperate(AnalogOutputInt32^ command, System::UInt32 index);
virtual IFuture<CommandResponse>^ DirectOperate(AnalogOutputInt16^ command, System::UInt32 index);
virtual IFuture<CommandResponse>^ DirectOperate(AnalogOutputFloat32^ command, System::UInt32 index);
virtual IFuture<CommandResponse>^ DirectOperate(AnalogOutputDouble64^ command, System::UInt32 index);

private:

template <class T>
IFuture<CommandResponse> ^ SelectAndOperateT(T ^ command, System::UInt32 index) {
IFuture<CommandResponse>^ SelectAndOperateT(T^ command, System::UInt32 index)
{
auto future = gcnew Future<CommandResponse>();
auto cmd = Conversions::convertCommand(command);
auto pWrapper = new gcroot < Future<CommandResponse> ^ > (future);
Expand All @@ -50,7 +51,8 @@ private ref class CommandProcessorAdapter : public ICommandProcessor
}

template <class T>
IFuture<CommandResponse> ^ DirectOperateT(T ^ command, System::UInt32 index) {
IFuture<CommandResponse>^ DirectOperateT(T^ command, System::UInt32 index)
{
auto future = gcnew Future<CommandResponse>();
auto cmd = Conversions::convertCommand(command);
auto pWrapper = new gcroot < Future<CommandResponse> ^ > (future);
Expand Down
Loading

0 comments on commit 0be4a14

Please sign in to comment.