Read about our upcoming Code of Conduct on this issue

Commit 97374f28 authored by f.gundelakh's avatar f.gundelakh
Browse files

Addded NOutputProxy

--HG--
branch : FixingIoRefactoring2
parent e06949d9beab
......@@ -83,11 +83,11 @@ bool NControlObjectSource::AReset(void)
{
UpdateOutputFlag=true;
if(Input.IsConnected() && Input->GetSize()>0)
if(Input.IsConnected() && Input->size()>0)
{
DataShift.Resize(Input->GetSize(),0.0);
DataIndexes.Resize(Input->GetSize(),0);
DataMul.Resize(Input->GetSize(),1.0);
DataShift.Resize(Input->size(),0.0);
DataIndexes.Resize(Input->size(),0);
DataMul.Resize(Input->size(),1.0);
}
return NSource::AReset();
}
......@@ -95,22 +95,88 @@ bool NControlObjectSource::AReset(void)
//
bool NControlObjectSource::ACalculate(void)
{
if(Input.IsConnected() && Input->GetSize()>0)
if(Input.IsConnected() && Input->size()>0)
{
DataShift.Resize(Input->GetSize(),0.0);
DataIndexes.Resize(Input->GetSize(),0);
DataMul.Resize(Input->GetSize(),1.0);
Output.Resize(1,Input->GetSize());
DataShift.Resize(Input->size(),0.0);
DataIndexes.Resize(Input->size(),0);
DataMul.Resize(Input->size(),1.0);
Output.Resize(1,Input->size());
UEPtr<UStorage> storage = GetStorage();
bool res(true);
for (int i=0; i<Input->size(); ++i)
{
std::string name="OutputProxy"+RDK::sntoa(i+1);
if(CheckName(name))
{
UEPtr<UContainer> cont=dynamic_pointer_cast<UContainer>(storage->TakeObject("NOutputProxy"));
if(!cont)
return 0;
cont->SetName(name);
this->AddComponent(cont);
}
}
//proxy1->Output.Resize(1,1);
}
else
Output.Resize(0,0);
for(int i=0;i<Input->GetSize();i++)
for(int i=0;i<Input->size();i++)
{
Output(0,i)=DataMul(i)*((*Input)(0,DataIndexes(i))-DataShift(i));
//Output(0,i)=DataMul(i)*((*Input)(0,DataIndexes(i))-DataShift(i));
MDMatrix<double> &matrix=*(*Input)[DataIndexes(i)];
Output(0,i) = DataMul(i)*matrix(0,0)-DataShift(i);
UEPtr<NOutputProxy> proxy = dynamic_pointer_cast<NOutputProxy> (GetComponent("OutputProxy"+RDK::sntoa(i+1)));
if(!proxy)
return false;
proxy->Output.Resize(1,1);
proxy->Output(0,0) = Output(0,i);
}
return true;
}
// --------------------------
NOutputProxy::NOutputProxy(void): UNet(),
Output("Output",this)
{
}
NOutputProxy::~NOutputProxy(void)
{
}
// --------------------------
//
// --------------------------
//
NOutputProxy* NOutputProxy::New(void)
{
return new NOutputProxy;
}
// --------------------------
// --------------------------
//
// --------------------------
//
bool NOutputProxy::ADefault(void)
{
return UNet::ADefault();
}
// .
bool NOutputProxy::AReset(void)
{
return UNet::AReset();
}
//
bool NOutputProxy::ACalculate(void)
{
return true;
}
}
#endif
......@@ -20,6 +20,25 @@ See file license.txt for more information
namespace NMSDK {
class RDK_LIB_TYPE NOutputProxy: public UNet
{
public:
UPropertyOutputData<MDMatrix<double>, NOutputProxy, ptOutput | ptPubState> Output;
NOutputProxy(void);
virtual ~NOutputProxy(void);
virtual NOutputProxy* New(void);
protected:
protected:
//
virtual bool ADefault(void);
// .
virtual bool AReset(void);
//
virtual bool ACalculate(void);
};
class RDK_LIB_TYPE NControlObjectSource: public NSource
{
......@@ -37,7 +56,7 @@ ULProperty<MDVector<double>,NControlObjectSource,ptPubParameter> DataMul;
public: //
///
UPropertyInputData<MDMatrix<double>,NControlObjectSource> Input;
UPropertyInputCData<MDMatrix<double>,NControlObjectSource> Input;
public: //
bool UpdateOutputFlag;
......@@ -78,6 +97,8 @@ virtual bool AReset(void);
//
virtual bool ACalculate(void);
// --------------------------
public:
UEPtr<NOutputProxy> proxy1;
};
}
......
......@@ -36,6 +36,11 @@ void NSourceLibrary::CreateClassSamples(UStorage *storage)
{
UContainer *cont;
cont=new NOutputProxy;
cont->SetName("OutputProxy");
cont->Default();
UploadClass("NOutputProxy",cont);
cont=new NPulseGenerator;
cont->SetName("PGenerator");
cont->Default();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment