33 namespace RobotRaconteur
38 template <
typename Y,
typename U>
39 static std::vector<Y> ConvertVectorType(
const std::vector<U>& in)
41 std::vector<Y> out(in.size());
42 for (
size_t i = 0; i < in.size(); i++)
43 out[i] = boost::numeric_cast<Y>(in[i]);
47 template <
typename Y,
typename U>
48 static RR_INTRUSIVE_PTR<RRArray<Y> > ConvertRRArrayType(
const RR_INTRUSIVE_PTR<RRArray<U> >& in)
50 RR_INTRUSIVE_PTR<RRArray<Y> > out = AllocateRRArray<Y>(in->size());
51 for (
size_t i = 0; i < in->size(); i++)
52 (*out)[i] = boost::numeric_cast<Y>((*in)[i]);
56 ROBOTRACONTEUR_CORE_API
void CalculateMatrixBlocks(uint32_t element_size, std::vector<uint64_t> count,
57 uint64_t max_elems, uint32_t& split_dim, uint64_t& split_dim_block,
58 uint64_t& split_elem_count, uint32_t& splits_count,
59 uint32_t& split_remainder, std::vector<uint64_t>& block_count,
60 std::vector<uint64_t>& block_count_edge);
72 virtual uint64_t Length() = 0;
103 template <
typename T>
107 RR_INTRUSIVE_PTR<RRArray<T> > memory;
108 boost::mutex memory_lock;
138 boost::mutex::scoped_lock lock(memory_lock);
139 this->memory = memory;
150 RR_OVIRTUAL uint64_t
Length() RR_OVERRIDE
152 boost::mutex::scoped_lock lock(memory_lock);
153 return memory->size();
170 virtual void Read(uint64_t memorypos, RR_INTRUSIVE_PTR<
RRArray<T> >& buffer, uint64_t bufferpos, uint64_t count)
172 boost::mutex::scoped_lock lock(memory_lock);
173 if (memorypos + count > memory->size())
175 if (bufferpos + count > buffer->size())
178 memcpy(buffer->data() + bufferpos, memory->data() + memorypos, boost::numeric_cast<size_t>(count *
sizeof(T)));
195 virtual void Write(uint64_t memorypos,
const RR_INTRUSIVE_PTR<
RRArray<T> >& buffer, uint64_t bufferpos,
198 boost::mutex::scoped_lock lock(memory_lock);
199 if (memorypos + count > memory->size())
201 if (bufferpos + count > buffer->size())
203 memcpy(memory->data() + memorypos, buffer->data() + bufferpos, boost::numeric_cast<size_t>(count *
sizeof(T)));
206 RR_OVIRTUAL
DataTypes ElementTypeID() RR_OVERRIDE {
return RRPrimUtil<T>::GetTypeID(); }
218 virtual std::vector<uint64_t> Dimensions() = 0;
219 virtual uint64_t DimCount() = 0;
250 template <
typename T>
254 RR_INTRUSIVE_PTR<RRMultiDimArray<T> > multimemory;
255 boost::mutex memory_lock;
287 boost::mutex::scoped_lock lock(memory_lock);
288 this->multimemory = multimemory;
303 boost::mutex::scoped_lock lock(memory_lock);
304 RR_INTRUSIVE_PTR<RRArray<uint32_t> > dims = multimemory->Dims;
305 std::vector<uint64_t> s(dims->size());
306 for (
size_t i = 0; i < s.size(); i++)
324 boost::mutex::scoped_lock lock(memory_lock);
325 return multimemory->Dims->size();
343 const std::vector<uint64_t>& bufferpos,
const std::vector<uint64_t>& count)
345 boost::mutex::scoped_lock lock(memory_lock);
346 multimemory->RetrieveSubArray(detail::ConvertVectorType<uint32_t>(memorypos), buffer,
347 detail::ConvertVectorType<uint32_t>(bufferpos),
348 detail::ConvertVectorType<uint32_t>(count));
367 const std::vector<uint64_t>& bufferpos,
const std::vector<uint64_t>& count)
369 boost::mutex::scoped_lock lock(memory_lock);
370 multimemory->AssignSubArray(detail::ConvertVectorType<uint32_t>(memorypos), buffer,
371 detail::ConvertVectorType<uint32_t>(bufferpos),
372 detail::ConvertVectorType<uint32_t>(count));
375 RR_OVIRTUAL
DataTypes ElementTypeID() RR_OVERRIDE {
return RRPrimUtil<T>::GetTypeID(); }
378 class ROBOTRACONTEUR_CORE_API ArrayMemoryServiceSkelBase :
private boost::noncopyable
382 std::string m_MemberName;
383 RR_WEAK_PTR<ServiceSkel> skel;
384 RR_WEAK_PTR<RobotRaconteurNode> node;
388 std::string service_path;
391 RR_SHARED_PTR<RobotRaconteurNode> GetNode();
392 std::string GetMemberName()
const;
393 ArrayMemoryServiceSkelBase(boost::string_ref membername,
const RR_SHARED_PTR<ServiceSkel>& skel,
394 DataTypes element_type,
size_t element_size, MemberDefinition_Direction direction);
395 virtual ~ArrayMemoryServiceSkelBase();
396 virtual RR_INTRUSIVE_PTR<MessageEntry> CallMemoryFunction(
const RR_INTRUSIVE_PTR<MessageEntry>& m,
397 const RR_SHARED_PTR<Endpoint>& e,
398 const RR_SHARED_PTR<ArrayMemoryBase>& mem);
401 virtual RR_INTRUSIVE_PTR<MessageElementData> DoRead(uint64_t memorypos, uint64_t bufferpos, uint64_t count,
402 const RR_SHARED_PTR<ArrayMemoryBase>& mem) = 0;
403 virtual void DoWrite(uint64_t memorypos,
const RR_INTRUSIVE_PTR<MessageElementData>& buffer, uint64_t bufferpos,
404 uint64_t count,
const RR_SHARED_PTR<ArrayMemoryBase>& mem) = 0;
407 template <
typename T>
408 class ArrayMemoryServiceSkel :
public ArrayMemoryServiceSkelBase
411 ArrayMemoryServiceSkel(boost::string_ref membername,
const RR_SHARED_PTR<ServiceSkel>& skel,
412 MemberDefinition_Direction direction)
413 : ArrayMemoryServiceSkelBase(membername, skel, RRPrimUtil<T>::GetTypeID(), sizeof(T), direction)
416 RR_OVIRTUAL RR_INTRUSIVE_PTR<MessageElementData> DoRead(uint64_t memorypos, uint64_t bufferpos, uint64_t count,
417 const RR_SHARED_PTR<ArrayMemoryBase>& mem) RR_OVERRIDE
419 RR_UNUSED(bufferpos);
420 RR_SHARED_PTR<ArrayMemory<T> > mem1 = rr_cast<ArrayMemory<T> >(mem);
421 RR_INTRUSIVE_PTR<RRArray<T> > buf1 = AllocateRRArray<T>(boost::numeric_cast<size_t>(count));
422 mem1->Read(memorypos, buf1, 0, boost::numeric_cast<size_t>(count));
426 RR_OVIRTUAL
void DoWrite(uint64_t memorypos,
const RR_INTRUSIVE_PTR<MessageElementData>& buffer, uint64_t bufferpos,
427 uint64_t count,
const RR_SHARED_PTR<ArrayMemoryBase>& mem) RR_OVERRIDE
429 RR_UNUSED(bufferpos);
430 RR_SHARED_PTR<ArrayMemory<T> > mem1 = rr_cast<ArrayMemory<T> >(mem);
431 RR_INTRUSIVE_PTR<RRArray<T> > buf1 = rr_cast<RRArray<T> >(buffer);
432 mem1->Write(memorypos, buf1, 0, boost::numeric_cast<size_t>(count));
436 class ROBOTRACONTEUR_CORE_API MultiDimArrayMemoryServiceSkelBase :
private boost::noncopyable
440 std::string m_MemberName;
441 RR_WEAK_PTR<ServiceSkel> skel;
442 RR_WEAK_PTR<RobotRaconteurNode> node;
446 std::string service_path;
449 RR_SHARED_PTR<RobotRaconteurNode> GetNode();
450 std::string GetMemberName()
const;
451 MultiDimArrayMemoryServiceSkelBase(boost::string_ref membername,
const RR_SHARED_PTR<ServiceSkel>& skel,
452 DataTypes element_type,
size_t element_size,
453 MemberDefinition_Direction direction);
454 virtual ~MultiDimArrayMemoryServiceSkelBase();
455 virtual RR_INTRUSIVE_PTR<MessageEntry> CallMemoryFunction(
const RR_INTRUSIVE_PTR<MessageEntry>& m,
456 const RR_SHARED_PTR<Endpoint>& e,
457 const RR_SHARED_PTR<MultiDimArrayMemoryBase>& mem);
458 virtual RR_INTRUSIVE_PTR<MessageElementData> DoRead(
const std::vector<uint64_t>& memorypos,
459 const std::vector<uint64_t>& bufferpos,
460 const std::vector<uint64_t>& count, uint32_t elem_count,
461 const RR_SHARED_PTR<MultiDimArrayMemoryBase>& mem) = 0;
462 virtual void DoWrite(
const std::vector<uint64_t>& memorypos,
const RR_INTRUSIVE_PTR<MessageElementData>& buffer,
463 const std::vector<uint64_t>& bufferpos,
const std::vector<uint64_t>& count,
464 uint32_t elem_count,
const RR_SHARED_PTR<MultiDimArrayMemoryBase>& mem) = 0;
467 template <
typename T>
468 class MultiDimArrayMemoryServiceSkel :
public MultiDimArrayMemoryServiceSkelBase
471 MultiDimArrayMemoryServiceSkel(boost::string_ref membername,
const RR_SHARED_PTR<ServiceSkel>& skel,
472 MemberDefinition_Direction direction)
473 : MultiDimArrayMemoryServiceSkelBase(membername, skel, RRPrimUtil<T>::GetTypeID(), sizeof(T), direction)
476 RR_OVIRTUAL RR_INTRUSIVE_PTR<MessageElementData> DoRead(
477 const std::vector<uint64_t>& memorypos,
const std::vector<uint64_t>& bufferpos,
478 const std::vector<uint64_t>& count, uint32_t elemcount,
479 const RR_SHARED_PTR<MultiDimArrayMemoryBase>& mem) RR_OVERRIDE
481 RR_SHARED_PTR<MultiDimArrayMemory<T> > mem1 = rr_cast<MultiDimArrayMemory<T> >(mem);
483 RR_INTRUSIVE_PTR<RRArray<T> > real = AllocateRRArray<T>(boost::numeric_cast<size_t>(elemcount));
484 RR_INTRUSIVE_PTR<RRMultiDimArray<T> > data;
486 data = AllocateRRMultiDimArray<T>(VectorToRRArray<uint32_t>(count), real);
488 mem1->Read(memorypos, data, bufferpos, count);
489 return GetNode()->PackMultiDimArray(data);
491 RR_OVIRTUAL
void DoWrite(
const std::vector<uint64_t>& memorypos,
const RR_INTRUSIVE_PTR<MessageElementData>& buffer,
492 const std::vector<uint64_t>& bufferpos,
const std::vector<uint64_t>& count,
493 uint32_t elemcount,
const RR_SHARED_PTR<MultiDimArrayMemoryBase>& mem) RR_OVERRIDE
495 RR_UNUSED(elemcount);
496 RR_SHARED_PTR<MultiDimArrayMemory<T> > mem1 = rr_cast<MultiDimArrayMemory<T> >(mem);
498 RR_INTRUSIVE_PTR<RRMultiDimArray<T> > data =
499 GetNode()->template UnpackMultiDimArray<T>(rr_cast<MessageElementNestedElementList>(buffer));
500 mem1->Write(memorypos, data, bufferpos, count);
504 class ROBOTRACONTEUR_CORE_API ArrayMemoryClientBase :
private boost::noncopyable
507 std::string m_MemberName;
508 RR_WEAK_PTR<ServiceStub> stub;
509 RR_WEAK_PTR<RobotRaconteurNode> node;
513 std::string service_path;
517 const std::string GetMemberName()
const;
518 RR_SHARED_PTR<RobotRaconteurNode> GetNode();
519 ArrayMemoryClientBase(boost::string_ref membername,
const RR_SHARED_PTR<ServiceStub>& stub, DataTypes element_type,
520 size_t element_size, MemberDefinition_Direction direction);
521 virtual ~ArrayMemoryClientBase();
523 RR_SHARED_PTR<ServiceStub> GetStub();
524 virtual uint64_t Length();
529 uint32_t remote_max_size;
530 boost::mutex max_size_lock;
531 uint32_t GetMaxTransferSize();
532 virtual void ReadBase(uint64_t memorypos,
void* buffer, uint64_t bufferpos, uint64_t count);
533 virtual void WriteBase(uint64_t memorypos,
const void* buffer, uint64_t bufferpos, uint64_t count);
539 virtual void UnpackReadResult(
const RR_INTRUSIVE_PTR<MessageElementData>& res,
void* buffer, uint64_t offset,
541 virtual RR_INTRUSIVE_PTR<MessageElementData> PackWriteRequest(
const void* buffer, uint64_t offset,
543 virtual size_t GetBufferLength(
const void* buffer) = 0;
546 template <
typename T>
547 class ArrayMemoryClient :
public virtual ArrayMemoryClientBase,
public virtual ArrayMemory<T>
550 ArrayMemoryClient(boost::string_ref membername,
const RR_SHARED_PTR<ServiceStub>& stub,
551 MemberDefinition_Direction direction)
552 : ArrayMemoryClientBase(membername, stub, RRPrimUtil<T>::GetTypeID(), sizeof(T), direction)
555 RR_OVIRTUAL
void Attach(
const RR_INTRUSIVE_PTR<RRArray<T> >& memory) RR_OVERRIDE
558 throw InvalidOperationException(
"Invalid for client");
561 RR_OVIRTUAL
void Read(uint64_t memorypos, RR_INTRUSIVE_PTR<RRArray<T> >& buffer, uint64_t bufferpos,
562 uint64_t count) RR_OVERRIDE
565 throw NullValueException(
"Buffer must not be null");
566 ReadBase(memorypos, &buffer, bufferpos, count);
569 RR_OVIRTUAL
void Write(uint64_t memorypos,
const RR_INTRUSIVE_PTR<RRArray<T> >& buffer, uint64_t bufferpos,
570 uint64_t count) RR_OVERRIDE
573 throw NullValueException(
"Buffer must not be null");
574 WriteBase(memorypos, &buffer, bufferpos, count);
577 RR_OVIRTUAL uint64_t Length() RR_OVERRIDE {
return ArrayMemoryClientBase::Length(); }
580 RR_OVIRTUAL
void UnpackReadResult(
const RR_INTRUSIVE_PTR<MessageElementData>& res,
void* buffer, uint64_t bufferpos,
581 uint64_t count) RR_OVERRIDE
583 RR_INTRUSIVE_PTR<RRArray<T> > data = rr_cast<RRArray<T> >(res);
584 RR_INTRUSIVE_PTR<RRArray<T> >& buffer1 = *
static_cast<RR_INTRUSIVE_PTR<RRArray<T>
>*>(buffer);
585 memcpy(buffer1->data() + bufferpos, data->data(), boost::numeric_cast<size_t>(count *
sizeof(T)));
588 RR_OVIRTUAL RR_INTRUSIVE_PTR<MessageElementData> PackWriteRequest(
const void* buffer, uint64_t bufferpos,
589 uint64_t count) RR_OVERRIDE
591 const RR_INTRUSIVE_PTR<RRArray<T> >& buffer1 = *
static_cast<const RR_INTRUSIVE_PTR<RRArray<T>
>*>(buffer);
592 if (bufferpos == 0 && buffer1->size() == boost::numeric_cast<size_t>(count))
596 else if ((buffer1->size() - boost::numeric_cast<size_t>(bufferpos)) >= boost::numeric_cast<size_t>(count))
598 RR_INTRUSIVE_PTR<RRArray<T> > data = AllocateRRArray<T>(boost::numeric_cast<size_t>(count));
599 memcpy(data->data(), buffer1->data() + bufferpos, boost::numeric_cast<size_t>(count *
sizeof(T)));
603 throw OutOfRangeException(
"");
606 RR_OVIRTUAL
size_t GetBufferLength(
const void* buffer) RR_OVERRIDE
608 const RR_INTRUSIVE_PTR<RRArray<T> >& buffer1 = *
static_cast<const RR_INTRUSIVE_PTR<RRArray<T>
>*>(buffer);
609 return buffer1->size();
613 class ROBOTRACONTEUR_CORE_API MultiDimArrayMemoryClientBase :
private boost::noncopyable
616 std::string m_MemberName;
617 RR_WEAK_PTR<ServiceStub> stub;
618 RR_WEAK_PTR<RobotRaconteurNode> node;
622 std::string service_path;
626 RR_SHARED_PTR<RobotRaconteurNode> GetNode();
627 const std::string GetMemberName()
const;
629 MultiDimArrayMemoryClientBase(boost::string_ref membername,
const RR_SHARED_PTR<ServiceStub>& stub,
630 DataTypes element_type,
size_t element_size, MemberDefinition_Direction direction);
631 virtual ~MultiDimArrayMemoryClientBase();
632 RR_SHARED_PTR<ServiceStub> GetStub();
634 virtual std::vector<uint64_t> Dimensions();
635 virtual uint64_t DimCount();
639 uint32_t remote_max_size;
640 boost::mutex max_size_lock;
642 uint32_t GetMaxTransferSize();
643 virtual void ReadBase(
const std::vector<uint64_t>& memorypos,
void* buffer,
const std::vector<uint64_t>& bufferpos,
644 const std::vector<uint64_t>& count);
645 virtual void WriteBase(
const std::vector<uint64_t>& memorypos,
const void* buffer,
646 const std::vector<uint64_t>& bufferpos,
const std::vector<uint64_t>& count);
652 virtual void UnpackReadResult(
const RR_INTRUSIVE_PTR<MessageElementData>& res,
void* buffer,
653 const std::vector<uint64_t>& bufferpos,
const std::vector<uint64_t>& count,
654 uint64_t elemcount) = 0;
655 virtual RR_INTRUSIVE_PTR<MessageElementData> PackWriteRequest(
const void* buffer,
656 const std::vector<uint64_t>& bufferpos,
657 const std::vector<uint64_t>& count,
658 uint64_t elemcount) = 0;
661 template <
typename T>
662 class MultiDimArrayMemoryClient :
public virtual MultiDimArrayMemory<T>,
public virtual MultiDimArrayMemoryClientBase
665 MultiDimArrayMemoryClient(boost::string_ref membername,
const RR_SHARED_PTR<ServiceStub>& stub,
666 MemberDefinition_Direction direction)
667 : MultiDimArrayMemoryClientBase(membername, stub, RRPrimUtil<T>::GetTypeID(), sizeof(T), direction)
670 RR_OVIRTUAL
void Attach(
const RR_INTRUSIVE_PTR<RRMultiDimArray<T> >& memory) RR_OVERRIDE
673 throw InvalidOperationException(
"Not valid for client");
676 RR_OVIRTUAL std::vector<uint64_t> Dimensions() RR_OVERRIDE {
return MultiDimArrayMemoryClientBase::Dimensions(); }
678 RR_OVIRTUAL uint64_t DimCount() RR_OVERRIDE {
return MultiDimArrayMemoryClientBase::DimCount(); }
680 RR_OVIRTUAL
void Read(
const std::vector<uint64_t>& memorypos, RR_INTRUSIVE_PTR<RRMultiDimArray<T> >& buffer,
681 const std::vector<uint64_t>& bufferpos,
const std::vector<uint64_t>& count) RR_OVERRIDE
684 throw NullValueException(
"Buffer must not be null");
685 ReadBase(memorypos, &buffer, bufferpos, count);
688 RR_OVIRTUAL
void Write(
const std::vector<uint64_t>& memorypos,
const RR_INTRUSIVE_PTR<RRMultiDimArray<T> >& buffer,
689 const std::vector<uint64_t>& bufferpos,
const std::vector<uint64_t>& count) RR_OVERRIDE
692 throw NullValueException(
"Buffer must not be null");
693 WriteBase(memorypos, &buffer, bufferpos, count);
697 RR_OVIRTUAL
void UnpackReadResult(
const RR_INTRUSIVE_PTR<MessageElementData>& res,
void* buffer,
698 const std::vector<uint64_t>& bufferpos,
const std::vector<uint64_t>& count,
699 uint64_t elemcount) RR_OVERRIDE
701 RR_UNUSED(elemcount);
702 RR_INTRUSIVE_PTR<RRMultiDimArray<T> >& buffer1 = *
static_cast<RR_INTRUSIVE_PTR<RRMultiDimArray<T>
>*>(buffer);
703 RR_INTRUSIVE_PTR<RRMultiDimArray<T> > data =
704 GetNode()->template UnpackMultiDimArray<T>(rr_cast<MessageElementNestedElementList>(res));
706 RR_SHARED_PTR<MultiDimArrayMemory<T> > data2 = RR_MAKE_SHARED<MultiDimArrayMemory<T> >(data);
707 data2->Read(std::vector<uint64_t>(count.size()), buffer1, bufferpos, count);
709 RR_OVIRTUAL RR_INTRUSIVE_PTR<MessageElementData> PackWriteRequest(
const void* buffer,
710 const std::vector<uint64_t>& bufferpos,
711 const std::vector<uint64_t>& count,
712 uint64_t elemcount) RR_OVERRIDE
714 const RR_INTRUSIVE_PTR<RRMultiDimArray<T> >& buffer1 =
715 *
static_cast<const RR_INTRUSIVE_PTR<RRMultiDimArray<T>
>*>(buffer);
718 for (
size_t i = 0; i < count.size(); i++)
720 if (bufferpos[i] != 0 ||
static_cast<uint64_t
>((*buffer1->Dims)[i]) != count[i])
729 return GetNode()->PackMultiDimArray(buffer1);
733 RR_INTRUSIVE_PTR<RRMultiDimArray<T> > data;
735 data = AllocateRRMultiDimArray<T>(VectorToRRArray<uint32_t>(count),
736 AllocateRRArray<T>(boost::numeric_cast<size_t>(elemcount)));
738 buffer1->RetrieveSubArray(detail::ConvertVectorType<uint32_t>(bufferpos), data,
739 std::vector<uint32_t>(count.size()), detail::ConvertVectorType<uint32_t>(count));
740 return GetNode()->PackMultiDimArray(data);
772 template <
typename T>
776 RR_INTRUSIVE_PTR<RRPodArray<T> > memory;
777 boost::mutex memory_lock;
807 boost::mutex::scoped_lock lock(memory_lock);
808 this->memory = memory;
812 RR_OVIRTUAL uint64_t
Length() RR_OVERRIDE
814 boost::mutex::scoped_lock lock(memory_lock);
815 return memory->size();
819 virtual void Read(uint64_t memorypos, RR_INTRUSIVE_PTR<
RRPodArray<T> >& buffer, uint64_t bufferpos, uint64_t count)
821 boost::mutex::scoped_lock lock(memory_lock);
822 if (memorypos + count > memory->size())
824 if (bufferpos + count > buffer->size())
827 for (
size_t i = 0; i < count; i++)
835 virtual void Write(uint64_t memorypos,
const RR_INTRUSIVE_PTR<
RRPodArray<T> >& buffer, uint64_t bufferpos,
838 boost::mutex::scoped_lock lock(memory_lock);
839 if (memorypos + count > memory->size())
841 if (bufferpos + count > buffer->size())
843 for (
size_t i = 0; i < count; i++)
853 template <
typename T>
854 class PodArrayMemoryServiceSkel :
public ArrayMemoryServiceSkelBase
857 PodArrayMemoryServiceSkel(boost::string_ref membername,
const RR_SHARED_PTR<ServiceSkel>& skel,
size_t element_size,
858 MemberDefinition_Direction direction)
859 : ArrayMemoryServiceSkelBase(membername, skel,
DataTypes_pod_t, element_size, direction)
862 RR_OVIRTUAL RR_INTRUSIVE_PTR<MessageElementData> DoRead(uint64_t memorypos, uint64_t bufferpos, uint64_t count,
863 const RR_SHARED_PTR<ArrayMemoryBase>& mem) RR_OVERRIDE
865 RR_UNUSED(bufferpos);
866 RR_SHARED_PTR<PodArrayMemory<T> > mem1 = rr_cast<PodArrayMemory<T> >(mem);
867 RR_INTRUSIVE_PTR<RRPodArray<T> > buf1 = AllocateEmptyRRPodArray<T>(boost::numeric_cast<size_t>(count));
868 mem1->Read(memorypos, buf1, 0, boost::numeric_cast<size_t>(count));
869 return PodStub_PackPodArray(buf1);
872 RR_OVIRTUAL
void DoWrite(uint64_t memorypos,
const RR_INTRUSIVE_PTR<MessageElementData>& buffer, uint64_t bufferpos,
873 uint64_t count,
const RR_SHARED_PTR<ArrayMemoryBase>& mem) RR_OVERRIDE
875 RR_UNUSED(bufferpos);
876 RR_SHARED_PTR<PodArrayMemory<T> > mem1 = rr_cast<PodArrayMemory<T> >(mem);
877 RR_INTRUSIVE_PTR<RRPodArray<T> > buf1 =
878 PodStub_UnpackPodArray<T>(rr_cast<MessageElementNestedElementList>(buffer));
879 mem1->Write(memorypos, buf1, 0, boost::numeric_cast<size_t>(count));
883 template <
typename T>
884 class PodArrayMemoryClient :
public virtual ArrayMemoryClientBase,
public virtual PodArrayMemory<T>
887 PodArrayMemoryClient(boost::string_ref membername,
const RR_SHARED_PTR<ServiceStub>& stub,
size_t element_size,
888 MemberDefinition_Direction direction)
889 : ArrayMemoryClientBase(membername, stub, RRPrimUtil<T>::GetTypeID(), element_size, direction)
892 RR_OVIRTUAL
void Attach(
const RR_INTRUSIVE_PTR<RRPodArray<T> >& memory) RR_OVERRIDE
895 throw InvalidOperationException(
"Invalid for client");
898 RR_OVIRTUAL
void Read(uint64_t memorypos, RR_INTRUSIVE_PTR<RRPodArray<T> >& buffer, uint64_t bufferpos,
899 uint64_t count) RR_OVERRIDE
902 throw NullValueException(
"Buffer must not be null");
903 ReadBase(memorypos, &buffer, bufferpos, count);
906 RR_OVIRTUAL
void Write(uint64_t memorypos,
const RR_INTRUSIVE_PTR<RRPodArray<T> >& buffer, uint64_t bufferpos,
907 uint64_t count) RR_OVERRIDE
910 throw NullValueException(
"Buffer must not be null");
911 WriteBase(memorypos, &buffer, bufferpos, count);
914 RR_OVIRTUAL uint64_t Length() RR_OVERRIDE {
return ArrayMemoryClientBase::Length(); }
917 RR_OVIRTUAL
void UnpackReadResult(
const RR_INTRUSIVE_PTR<MessageElementData>& res,
void* buffer, uint64_t bufferpos,
918 uint64_t count) RR_OVERRIDE
920 RR_INTRUSIVE_PTR<RRPodArray<T> >& buffer1 = *
static_cast<RR_INTRUSIVE_PTR<RRPodArray<T>
>*>(buffer);
921 RR_INTRUSIVE_PTR<RRPodArray<T> > res1 =
922 PodStub_UnpackPodArray<T>(rr_cast<RobotRaconteur::MessageElementNestedElementList>(res));
924 for (
size_t i = 0; i < count; i++)
930 RR_OVIRTUAL RR_INTRUSIVE_PTR<MessageElementData> PackWriteRequest(
const void* buffer, uint64_t bufferpos,
931 uint64_t count) RR_OVERRIDE
933 RR_INTRUSIVE_PTR<RRPodArray<T> > buffer1 = *
static_cast<const RR_INTRUSIVE_PTR<RRPodArray<T>
>*>(buffer);
934 RR_INTRUSIVE_PTR<RRPodArray<T> > o = AllocateEmptyRRPodArray<T>(boost::numeric_cast<size_t>(count));
936 for (
size_t i = 0; i < count; i++)
940 return PodStub_PackPodArray(o);
943 RR_OVIRTUAL
size_t GetBufferLength(
const void* buffer) RR_OVERRIDE
945 const RR_INTRUSIVE_PTR<RRPodArray<T> >& buffer1 = *
static_cast<const RR_INTRUSIVE_PTR<RRPodArray<T>
>*>(buffer);
946 return buffer1->size();
975 template <
typename T>
979 RR_INTRUSIVE_PTR<RRPodMultiDimArray<T> > multimemory;
980 boost::mutex memory_lock;
1003 this->multimemory = multimemory;
1015 boost::mutex::scoped_lock lock(memory_lock);
1016 this->multimemory = multimemory;
1022 boost::mutex::scoped_lock lock(memory_lock);
1023 RR_INTRUSIVE_PTR<RRArray<uint32_t> > dims = multimemory->Dims;
1024 std::vector<uint64_t> s(dims->size());
1025 for (
size_t i = 0; i < s.size(); i++)
1036 boost::mutex::scoped_lock lock(memory_lock);
1037 return multimemory->Dims->size();
1042 const std::vector<uint64_t>& bufferpos,
const std::vector<uint64_t>& count)
1044 boost::mutex::scoped_lock lock(memory_lock);
1045 multimemory->RetrieveSubArray(detail::ConvertVectorType<uint32_t>(memorypos), buffer,
1046 detail::ConvertVectorType<uint32_t>(bufferpos),
1047 detail::ConvertVectorType<uint32_t>(count));
1052 const std::vector<uint64_t>& bufferpos,
const std::vector<uint64_t>& count)
1054 boost::mutex::scoped_lock lock(memory_lock);
1055 multimemory->AssignSubArray(detail::ConvertVectorType<uint32_t>(memorypos), buffer,
1056 detail::ConvertVectorType<uint32_t>(bufferpos),
1057 detail::ConvertVectorType<uint32_t>(count));
1063 template <
typename T>
1064 class PodMultiDimArrayMemoryClient :
public virtual PodMultiDimArrayMemory<T>,
1065 public virtual MultiDimArrayMemoryClientBase
1068 PodMultiDimArrayMemoryClient(boost::string_ref membername,
const RR_SHARED_PTR<ServiceStub>& stub,
1069 size_t element_size, MemberDefinition_Direction direction)
1070 : MultiDimArrayMemoryClientBase(membername, stub,
DataTypes_pod_t, element_size, direction)
1073 RR_OVIRTUAL
void Attach(
const RR_INTRUSIVE_PTR<RRPodMultiDimArray<T> >& memory) RR_OVERRIDE
1076 throw InvalidOperationException(
"Not valid for client");
1079 RR_OVIRTUAL std::vector<uint64_t> Dimensions() RR_OVERRIDE {
return MultiDimArrayMemoryClientBase::Dimensions(); }
1081 RR_OVIRTUAL uint64_t DimCount() RR_OVERRIDE {
return MultiDimArrayMemoryClientBase::DimCount(); }
1083 RR_OVIRTUAL
void Read(
const std::vector<uint64_t>& memorypos, RR_INTRUSIVE_PTR<RRPodMultiDimArray<T> >& buffer,
1084 const std::vector<uint64_t>& bufferpos,
const std::vector<uint64_t>& count) RR_OVERRIDE
1087 throw NullValueException(
"Buffer must not be null");
1088 ReadBase(memorypos, &buffer, bufferpos, count);
1091 RR_OVIRTUAL
void Write(
const std::vector<uint64_t>& memorypos,
1092 const RR_INTRUSIVE_PTR<RRPodMultiDimArray<T> >& buffer,
1093 const std::vector<uint64_t>& bufferpos,
const std::vector<uint64_t>& count) RR_OVERRIDE
1096 throw NullValueException(
"Buffer must not be null");
1097 WriteBase(memorypos, &buffer, bufferpos, count);
1101 RR_OVIRTUAL
void UnpackReadResult(
const RR_INTRUSIVE_PTR<MessageElementData>& res,
void* buffer,
1102 const std::vector<uint64_t>& bufferpos,
const std::vector<uint64_t>& count,
1103 uint64_t elemcount) RR_OVERRIDE
1105 RR_UNUSED(elemcount);
1106 RR_INTRUSIVE_PTR<RRPodMultiDimArray<T> >& buffer1 =
1107 *
static_cast<RR_INTRUSIVE_PTR<RRPodMultiDimArray<T>
>*>(buffer);
1108 RR_INTRUSIVE_PTR<RRPodMultiDimArray<T> > data = rr_cast<RRPodMultiDimArray<T> >(
1109 GetNode()->UnpackPodMultiDimArray(rr_cast<MessageElementNestedElementList>(res)));
1111 RR_SHARED_PTR<PodMultiDimArrayMemory<T> > data2 = RR_MAKE_SHARED<PodMultiDimArrayMemory<T> >(data);
1112 data2->Read(std::vector<uint64_t>(count.size()), buffer1, bufferpos, count);
1114 RR_OVIRTUAL RR_INTRUSIVE_PTR<MessageElementData> PackWriteRequest(
const void* buffer,
1115 const std::vector<uint64_t>& bufferpos,
1116 const std::vector<uint64_t>& count,
1117 uint64_t elemcount) RR_OVERRIDE
1119 const RR_INTRUSIVE_PTR<RRPodMultiDimArray<T> >& buffer1 =
1120 *
static_cast<const RR_INTRUSIVE_PTR<RRPodMultiDimArray<T>
>*>(buffer);
1122 RR_INTRUSIVE_PTR<RRPodMultiDimArray<T> > data = AllocateEmptyRRPodMultiDimArray<T>();
1123 data->Dims = VectorToRRArray<uint32_t>(count);
1124 data->PodArray = AllocateEmptyRRPodArray<T>(boost::numeric_cast<size_t>(elemcount));
1126 buffer1->RetrieveSubArray(detail::ConvertVectorType<uint32_t>(bufferpos), data,
1127 std::vector<uint32_t>(count.size()), detail::ConvertVectorType<uint32_t>(count));
1128 return GetNode()->PackPodMultiDimArray(data);
1132 template <
typename T>
1133 class PodMultiDimArrayMemoryServiceSkel :
public MultiDimArrayMemoryServiceSkelBase
1136 PodMultiDimArrayMemoryServiceSkel(boost::string_ref membername,
const RR_SHARED_PTR<ServiceSkel>& skel,
1137 size_t element_size, MemberDefinition_Direction direction)
1138 : MultiDimArrayMemoryServiceSkelBase(membername, skel,
DataTypes_structure_t, element_size, direction)
1141 RR_OVIRTUAL RR_INTRUSIVE_PTR<MessageElementData> DoRead(
1142 const std::vector<uint64_t>& memorypos,
const std::vector<uint64_t>& bufferpos,
1143 const std::vector<uint64_t>& count, uint32_t elemcount,
1144 const RR_SHARED_PTR<MultiDimArrayMemoryBase>& mem) RR_OVERRIDE
1146 RR_SHARED_PTR<PodMultiDimArrayMemory<T> > mem1 = rr_cast<PodMultiDimArrayMemory<T> >(mem);
1148 RR_INTRUSIVE_PTR<RRPodMultiDimArray<T> > data = AllocateEmptyRRPodMultiDimArray<T>();
1149 data->Dims = VectorToRRArray<uint32_t>(count);
1150 data->PodArray = AllocateEmptyRRPodArray<T>(boost::numeric_cast<size_t>(elemcount));
1152 mem1->Read(memorypos, data, bufferpos, count);
1153 return GetNode()->PackPodMultiDimArray(data);
1155 RR_OVIRTUAL
void DoWrite(
const std::vector<uint64_t>& memorypos,
const RR_INTRUSIVE_PTR<MessageElementData>& buffer,
1156 const std::vector<uint64_t>& bufferpos,
const std::vector<uint64_t>& count,
1157 uint32_t elemcount,
const RR_SHARED_PTR<MultiDimArrayMemoryBase>& mem) RR_OVERRIDE
1159 RR_UNUSED(elemcount);
1160 RR_SHARED_PTR<PodMultiDimArrayMemory<T> > mem1 = rr_cast<PodMultiDimArrayMemory<T> >(mem);
1162 RR_INTRUSIVE_PTR<RRPodMultiDimArray<T> > data = rr_cast<RRPodMultiDimArray<T> >(
1163 GetNode()->UnpackPodMultiDimArray(rr_cast<MessageElementNestedElementList>(buffer)));
1164 mem1->Write(memorypos, data, bufferpos, count);
1195 template <
typename T>
1199 RR_INTRUSIVE_PTR<RRNamedArray<T> > memory;
1200 boost::mutex memory_lock;
1230 boost::mutex::scoped_lock lock(memory_lock);
1231 this->memory = memory;
1237 boost::mutex::scoped_lock lock(memory_lock);
1238 return memory->size();
1245 boost::mutex::scoped_lock lock(memory_lock);
1246 if (memorypos + count > memory->size())
1248 if (bufferpos + count > buffer->size())
1251 for (
size_t i = 0; i < count; i++)
1253 (*buffer)[boost::numeric_cast<typename RRNamedArray<T>::size_type>(i + bufferpos)] =
1254 (*memory)[boost::numeric_cast<typename RRNamedArray<T>::size_type>(i + memorypos)];
1262 boost::mutex::scoped_lock lock(memory_lock);
1263 if (memorypos + count > memory->size())
1265 if (bufferpos + count > buffer->size())
1267 for (
size_t i = 0; i < count; i++)
1269 (*memory)[boost::numeric_cast<typename RRNamedArray<T>::size_type>(i + memorypos)] =
1270 (*buffer)[boost::numeric_cast<typename RRNamedArray<T>::size_type>(i + bufferpos)];
1277 template <
typename T>
1278 class NamedArrayMemoryServiceSkel :
public ArrayMemoryServiceSkelBase
1281 NamedArrayMemoryServiceSkel(boost::string_ref membername,
const RR_SHARED_PTR<ServiceSkel>& skel,
1282 size_t element_size, MemberDefinition_Direction direction)
1283 : ArrayMemoryServiceSkelBase(membername, skel,
DataTypes_pod_t, element_size, direction)
1286 RR_OVIRTUAL RR_INTRUSIVE_PTR<MessageElementData> DoRead(uint64_t memorypos, uint64_t bufferpos, uint64_t count,
1287 const RR_SHARED_PTR<ArrayMemoryBase>& mem) RR_OVERRIDE
1289 RR_UNUSED(bufferpos);
1290 RR_SHARED_PTR<NamedArrayMemory<T> > mem1 = rr_cast<NamedArrayMemory<T> >(mem);
1291 RR_INTRUSIVE_PTR<RRNamedArray<T> > buf1 = AllocateEmptyRRNamedArray<T>(boost::numeric_cast<size_t>(count));
1292 mem1->Read(memorypos, buf1, 0, boost::numeric_cast<size_t>(count));
1293 return NamedArrayStub_PackNamedArray(buf1);
1296 RR_OVIRTUAL
void DoWrite(uint64_t memorypos,
const RR_INTRUSIVE_PTR<MessageElementData>& buffer, uint64_t bufferpos,
1297 uint64_t count,
const RR_SHARED_PTR<ArrayMemoryBase>& mem) RR_OVERRIDE
1299 RR_UNUSED(bufferpos);
1300 RR_SHARED_PTR<NamedArrayMemory<T> > mem1 = rr_cast<NamedArrayMemory<T> >(mem);
1301 RR_INTRUSIVE_PTR<RRNamedArray<T> > buf1 =
1302 NamedArrayStub_UnpackNamedArray<T>(rr_cast<MessageElementNestedElementList>(buffer));
1303 mem1->Write(memorypos, buf1, 0, boost::numeric_cast<size_t>(count));
1307 template <
typename T>
1308 class NamedArrayMemoryClient :
public virtual ArrayMemoryClientBase,
public virtual NamedArrayMemory<T>
1311 NamedArrayMemoryClient(boost::string_ref membername,
const RR_SHARED_PTR<ServiceStub>& stub,
size_t element_size,
1312 MemberDefinition_Direction direction)
1313 : ArrayMemoryClientBase(membername, stub, RRPrimUtil<T>::GetTypeID(), element_size, direction)
1316 RR_OVIRTUAL
void Attach(
const RR_INTRUSIVE_PTR<RRNamedArray<T> >& memory) RR_OVERRIDE
1319 throw InvalidOperationException(
"Invalid for client");
1322 RR_OVIRTUAL
void Read(uint64_t memorypos, RR_INTRUSIVE_PTR<RRNamedArray<T> >& buffer, uint64_t bufferpos,
1323 uint64_t count) RR_OVERRIDE
1326 throw NullValueException(
"Buffer must not be null");
1327 ReadBase(memorypos, &buffer, bufferpos, count);
1330 RR_OVIRTUAL
void Write(uint64_t memorypos,
const RR_INTRUSIVE_PTR<RRNamedArray<T> >& buffer, uint64_t bufferpos,
1331 uint64_t count) RR_OVERRIDE
1334 throw NullValueException(
"Buffer must not be null");
1335 WriteBase(memorypos, &buffer, bufferpos, count);
1338 RR_OVIRTUAL uint64_t Length() RR_OVERRIDE {
return ArrayMemoryClientBase::Length(); }
1341 RR_OVIRTUAL
void UnpackReadResult(
const RR_INTRUSIVE_PTR<MessageElementData>& res,
void* buffer, uint64_t bufferpos,
1342 uint64_t count) RR_OVERRIDE
1344 RR_INTRUSIVE_PTR<RRNamedArray<T> >& buffer1 = *
static_cast<RR_INTRUSIVE_PTR<RRNamedArray<T>
>*>(buffer);
1345 RR_INTRUSIVE_PTR<RRNamedArray<T> > res1 =
1346 NamedArrayStub_UnpackNamedArray<T>(rr_cast<RobotRaconteur::MessageElementNestedElementList>(res));
1348 for (
size_t i = 0; i < count; i++)
1350 (*buffer1)[boost::numeric_cast<typename RRNamedArray<T>::size_type>(i + bufferpos)] = (*res1)[i];
1354 RR_OVIRTUAL RR_INTRUSIVE_PTR<MessageElementData> PackWriteRequest(
const void* buffer, uint64_t bufferpos,
1355 uint64_t count) RR_OVERRIDE
1357 RR_INTRUSIVE_PTR<RRNamedArray<T> > buffer1 = *
static_cast<const RR_INTRUSIVE_PTR<RRNamedArray<T>
>*>(buffer);
1358 RR_INTRUSIVE_PTR<RRNamedArray<T> > o = AllocateEmptyRRNamedArray<T>(boost::numeric_cast<size_t>(count));
1360 for (
size_t i = 0; i < count; i++)
1362 (*o)[i] = (*buffer1)[boost::numeric_cast<typename RRNamedArray<T>::size_type>(i + bufferpos)];
1364 return NamedArrayStub_PackNamedArray(o);
1367 RR_OVIRTUAL
size_t GetBufferLength(
const void* buffer) RR_OVERRIDE
1369 RR_INTRUSIVE_PTR<RRNamedArray<T> > buffer1 = *
static_cast<const RR_INTRUSIVE_PTR<RRNamedArray<T>
>*>(buffer);
1370 return buffer1->size();
1399 template <
typename T>
1403 RR_INTRUSIVE_PTR<RRNamedMultiDimArray<T> > multimemory;
1404 boost::mutex memory_lock;
1427 this->multimemory = multimemory;
1439 boost::mutex::scoped_lock lock(memory_lock);
1440 this->multimemory = multimemory;
1446 boost::mutex::scoped_lock lock(memory_lock);
1447 RR_INTRUSIVE_PTR<RRArray<uint32_t> > dims = multimemory->Dims;
1448 std::vector<uint64_t> s(dims->size());
1449 for (
size_t i = 0; i < s.size(); i++)
1460 boost::mutex::scoped_lock lock(memory_lock);
1461 return multimemory->Dims->size();
1466 const std::vector<uint64_t>& bufferpos,
const std::vector<uint64_t>& count)
1468 boost::mutex::scoped_lock lock(memory_lock);
1469 multimemory->RetrieveSubArray(detail::ConvertVectorType<uint32_t>(memorypos), buffer,
1470 detail::ConvertVectorType<uint32_t>(bufferpos),
1471 detail::ConvertVectorType<uint32_t>(count));
1476 const std::vector<uint64_t>& bufferpos,
const std::vector<uint64_t>& count)
1478 boost::mutex::scoped_lock lock(memory_lock);
1479 multimemory->AssignSubArray(detail::ConvertVectorType<uint32_t>(memorypos), buffer,
1480 detail::ConvertVectorType<uint32_t>(bufferpos),
1481 detail::ConvertVectorType<uint32_t>(count));
1487 template <
typename T>
1488 class NamedMultiDimArrayMemoryClient :
public virtual NamedMultiDimArrayMemory<T>,
1489 public virtual MultiDimArrayMemoryClientBase
1492 NamedMultiDimArrayMemoryClient(boost::string_ref membername,
const RR_SHARED_PTR<ServiceStub>& stub,
1493 size_t element_size, MemberDefinition_Direction direction)
1494 : MultiDimArrayMemoryClientBase(membername, stub,
DataTypes_pod_t, element_size, direction)
1497 RR_OVIRTUAL
void Attach(
const RR_INTRUSIVE_PTR<RRNamedMultiDimArray<T> >& memory) RR_OVERRIDE
1500 throw InvalidOperationException(
"Not valid for client");
1503 RR_OVIRTUAL std::vector<uint64_t> Dimensions() RR_OVERRIDE {
return MultiDimArrayMemoryClientBase::Dimensions(); }
1505 RR_OVIRTUAL uint64_t DimCount() RR_OVERRIDE {
return MultiDimArrayMemoryClientBase::DimCount(); }
1507 RR_OVIRTUAL
void Read(
const std::vector<uint64_t>& memorypos, RR_INTRUSIVE_PTR<RRNamedMultiDimArray<T> >& buffer,
1508 const std::vector<uint64_t>& bufferpos,
const std::vector<uint64_t>& count) RR_OVERRIDE
1511 throw NullValueException(
"Buffer must not be null");
1512 ReadBase(memorypos, &buffer, bufferpos, count);
1515 RR_OVIRTUAL
void Write(
const std::vector<uint64_t>& memorypos,
1516 const RR_INTRUSIVE_PTR<RRNamedMultiDimArray<T> >& buffer,
1517 const std::vector<uint64_t>& bufferpos,
const std::vector<uint64_t>& count) RR_OVERRIDE
1520 throw NullValueException(
"Buffer must not be null");
1521 WriteBase(memorypos, &buffer, bufferpos, count);
1525 RR_OVIRTUAL
void UnpackReadResult(
const RR_INTRUSIVE_PTR<MessageElementData>& res,
void* buffer,
1526 const std::vector<uint64_t>& bufferpos,
const std::vector<uint64_t>& count,
1527 uint64_t elemcount) RR_OVERRIDE
1529 RR_UNUSED(elemcount);
1530 RR_INTRUSIVE_PTR<RRNamedMultiDimArray<T> >& buffer1 =
1531 *
static_cast<RR_INTRUSIVE_PTR<RRNamedMultiDimArray<T>
>*>(buffer);
1532 RR_INTRUSIVE_PTR<RRNamedMultiDimArray<T> > data = rr_cast<RRNamedMultiDimArray<T> >(
1533 GetNode()->UnpackNamedMultiDimArray(rr_cast<MessageElementNestedElementList>(res)));
1535 RR_SHARED_PTR<NamedMultiDimArrayMemory<T> > data2 = RR_MAKE_SHARED<NamedMultiDimArrayMemory<T> >(data);
1536 data2->Read(std::vector<uint64_t>(count.size()), buffer1, bufferpos, count);
1538 RR_OVIRTUAL RR_INTRUSIVE_PTR<MessageElementData> PackWriteRequest(
const void* buffer,
1539 const std::vector<uint64_t>& bufferpos,
1540 const std::vector<uint64_t>& count,
1541 uint64_t elemcount) RR_OVERRIDE
1543 RR_INTRUSIVE_PTR<RRNamedMultiDimArray<T> > buffer1 =
1544 *
static_cast<const RR_INTRUSIVE_PTR<RRNamedMultiDimArray<T>
>*>(buffer);
1546 RR_INTRUSIVE_PTR<RRNamedMultiDimArray<T> > data = AllocateEmptyRRNamedMultiDimArray<T>();
1547 data->Dims = VectorToRRArray<uint32_t>(count);
1548 data->NamedArray = AllocateEmptyRRNamedArray<T>(boost::numeric_cast<size_t>(elemcount));
1550 buffer1->RetrieveSubArray(detail::ConvertVectorType<uint32_t>(bufferpos), data,
1551 std::vector<uint32_t>(count.size()), detail::ConvertVectorType<uint32_t>(count));
1552 return GetNode()->PackNamedMultiDimArray(data);
1556 template <
typename T>
1557 class NamedMultiDimArrayMemoryServiceSkel :
public MultiDimArrayMemoryServiceSkelBase
1560 NamedMultiDimArrayMemoryServiceSkel(boost::string_ref membername,
const RR_SHARED_PTR<ServiceSkel>& skel,
1561 size_t element_size, MemberDefinition_Direction direction)
1562 : MultiDimArrayMemoryServiceSkelBase(membername, skel,
DataTypes_structure_t, element_size, direction)
1565 RR_OVIRTUAL RR_INTRUSIVE_PTR<MessageElementData> DoRead(
1566 const std::vector<uint64_t>& memorypos,
const std::vector<uint64_t>& bufferpos,
1567 const std::vector<uint64_t>& count, uint32_t elemcount,
1568 const RR_SHARED_PTR<MultiDimArrayMemoryBase>& mem) RR_OVERRIDE
1570 RR_SHARED_PTR<NamedMultiDimArrayMemory<T> > mem1 = rr_cast<NamedMultiDimArrayMemory<T> >(mem);
1572 RR_INTRUSIVE_PTR<RRNamedMultiDimArray<T> > data = AllocateEmptyRRNamedMultiDimArray<T>();
1573 data->Dims = VectorToRRArray<uint32_t>(count);
1574 data->NamedArray = AllocateEmptyRRNamedArray<T>(boost::numeric_cast<size_t>(elemcount));
1576 mem1->Read(memorypos, data, bufferpos, count);
1577 return GetNode()->PackNamedMultiDimArray(data);
1579 RR_OVIRTUAL
void DoWrite(
const std::vector<uint64_t>& memorypos,
const RR_INTRUSIVE_PTR<MessageElementData>& buffer,
1580 const std::vector<uint64_t>& bufferpos,
const std::vector<uint64_t>& count,
1581 uint32_t elemcount,
const RR_SHARED_PTR<MultiDimArrayMemoryBase>& mem) RR_OVERRIDE
1583 RR_UNUSED(elemcount);
1584 RR_SHARED_PTR<NamedMultiDimArrayMemory<T> > mem1 = rr_cast<NamedMultiDimArrayMemory<T> >(mem);
1586 RR_INTRUSIVE_PTR<RRNamedMultiDimArray<T> > data = rr_cast<RRNamedMultiDimArray<T> >(
1587 GetNode()->UnpackNamedMultiDimArray(rr_cast<MessageElementNestedElementList>(buffer)));
1588 mem1->Write(memorypos, data, bufferpos, count);
1592 #ifndef ROBOTRACONTEUR_NO_CXX11_TEMPLATE_ALIASES
1596 template <
typename T>
1601 template <
typename T>
1604 template <
typename T>
1607 template <
typename T>
1610 template <
typename T>
1613 template <
typename T>
boost::shared_ptr< MultiDimArrayMemoryBase > MultiDimArrayMemoryBasePtr
Convenience alias for MultiDimArrayMemoryBase shared_ptr.
Definition: MemoryMember.h:1599
boost::shared_ptr< ArrayMemory< T > > ArrayMemoryPtr
Convenience alias for ArrayMemory shared_ptr.
Definition: MemoryMember.h:1597
boost::shared_ptr< ArrayMemoryBase > ArrayMemoryBasePtr
Convenience alias for ArrayMemoryBase shared_ptr.
Definition: MemoryMember.h:1594
boost::shared_ptr< PodMultiDimArrayMemory< T > > PodMultiDimArrayMemoryPtr
Convenience alias for PodMultiDimArrayMemory shared_ptr.
Definition: MemoryMember.h:1608
boost::shared_ptr< MultiDimArrayMemory< T > > MultiDimArrayMemoryPtr
Convenience alias for MultiDimArrayMemory shared_ptr.
Definition: MemoryMember.h:1602
boost::shared_ptr< NamedArrayMemory< T > > NamedArrayMemoryPtr
Convenience alias for NamedArrayMemory shared_ptr.
Definition: MemoryMember.h:1611
boost::shared_ptr< NamedMultiDimArrayMemory< T > > NamedMultiDimArrayMemoryPtr
Convenience alias for NamedMultiDimArrayMemory shared_ptr.
Definition: MemoryMember.h:1614
boost::shared_ptr< PodArrayMemory< T > > PodArrayMemoryPtr
Convenience alias for PodArrayMemory shared_ptr.
Definition: MemoryMember.h:1605
MemberDefinition_Direction
Member direction enum.
Definition: RobotRaconteurConstants.h:534
DataTypes
Type codes for types supported by Robot Raconteur.
Definition: RobotRaconteurConstants.h:41
@ DataTypes_structure_t
structure (nested message type)
Definition: RobotRaconteurConstants.h:73
@ DataTypes_pod_t
pod type (nested message type)
Definition: RobotRaconteurConstants.h:88
Base class for ArrayMemory.
Definition: MemoryMember.h:70
Single dimensional numeric primitive random access memory region.
Definition: MemoryMember.h:105
virtual void Read(uint64_t memorypos, boost::intrusive_ptr< RRArray< T > > &buffer, uint64_t bufferpos, uint64_t count)
Read a segment from an array memory.
Definition: MemoryMember.h:170
ArrayMemory(const boost::intrusive_ptr< RRArray< T > > &memory)
Construct a new ArrayMemory instance attached to an RRArrayPtr<T>
Definition: MemoryMember.h:129
ArrayMemory()
Construct a new ArrayMemory instance.
Definition: MemoryMember.h:118
virtual void Write(uint64_t memorypos, const boost::intrusive_ptr< RRArray< T > > &buffer, uint64_t bufferpos, uint64_t count)
Write a segment to an array memory.
Definition: MemoryMember.h:195
RR_OVIRTUAL uint64_t Length() RR_OVERRIDE
Return the length of the array memory.
Definition: MemoryMember.h:150
virtual void Attach(const boost::intrusive_ptr< RRArray< T > > &memory)
Attach ArrayMemory instance to an RRArrayPtr<T>
Definition: MemoryMember.h:136
Base class for MultiDimArrayMemory.
Definition: MemoryMember.h:216
Multidimensional numeric primitive random access memory region.
Definition: MemoryMember.h:252
RR_OVIRTUAL uint64_t DimCount() RR_OVERRIDE
The number of dimensions in the memory array.
Definition: MemoryMember.h:322
virtual void Read(const std::vector< uint64_t > &memorypos, boost::intrusive_ptr< RRMultiDimArray< T > > &buffer, const std::vector< uint64_t > &bufferpos, const std::vector< uint64_t > &count)
Read a block from a multidimensional array memory.
Definition: MemoryMember.h:342
virtual void Write(const std::vector< uint64_t > &memorypos, const boost::intrusive_ptr< RRMultiDimArray< T > > &buffer, const std::vector< uint64_t > &bufferpos, const std::vector< uint64_t > &count)
Write a segment to a multidimensional array memory.
Definition: MemoryMember.h:366
MultiDimArrayMemory()
Construct a new MultiDimArrayMemory instance.
Definition: MemoryMember.h:265
virtual void Attach(const boost::intrusive_ptr< RRMultiDimArray< T > > &multimemory)
Attach MultiDimArrayMemory instance to an RRMultiDimArrayPtr<T>
Definition: MemoryMember.h:285
RR_OVIRTUAL std::vector< uint64_t > Dimensions() RR_OVERRIDE
Dimensions of the memory array.
Definition: MemoryMember.h:301
MultiDimArrayMemory(const boost::intrusive_ptr< RRMultiDimArray< T > > &multimemory)
Construct a new MultiDimArrayMemory instance attached to an RRMultiDimArrayPtr<T>
Definition: MemoryMember.h:276
Single dimensional namedarray random access memory region.
Definition: MemoryMember.h:1197
virtual void Attach(const boost::intrusive_ptr< RRNamedArray< T > > &memory)
Attach NamedArrayMemory instance to an RRNamedArrayPtr<T>
Definition: MemoryMember.h:1228
NamedArrayMemory()
Construct a new NamedArrayMemory instance.
Definition: MemoryMember.h:1210
RR_OVIRTUAL uint64_t Length() RR_OVERRIDE
Return the length of the array memory.
Definition: MemoryMember.h:1235
virtual void Read(uint64_t memorypos, boost::intrusive_ptr< RRNamedArray< T > > &buffer, uint64_t bufferpos, uint64_t count)
Read a segment from an array memory.
Definition: MemoryMember.h:1242
virtual void Write(uint64_t memorypos, const boost::intrusive_ptr< RRNamedArray< T > > &buffer, uint64_t bufferpos, uint64_t count)
Write a segment to an array memory.
Definition: MemoryMember.h:1259
NamedArrayMemory(const boost::intrusive_ptr< RRNamedArray< T > > &memory)
Construct a new NamedArrayMemory instance attached to an RRNamedArrayPtr<T>
Definition: MemoryMember.h:1221
Multidimensional namedarray random access memory region.
Definition: MemoryMember.h:1401
virtual void Attach(const boost::intrusive_ptr< RRNamedMultiDimArray< T > > &multimemory)
Attach NamedMultiDimArrayMemory instance to an RRNamedMultiDimArrayPtr<T>
Definition: MemoryMember.h:1437
RR_OVIRTUAL uint64_t DimCount() RR_OVERRIDE
The number of dimensions in the memory array.
Definition: MemoryMember.h:1458
virtual void Write(const std::vector< uint64_t > &memorypos, const boost::intrusive_ptr< RRNamedMultiDimArray< T > > &buffer, const std::vector< uint64_t > &bufferpos, const std::vector< uint64_t > &count)
Write a segment to a multidimensional array memory.
Definition: MemoryMember.h:1475
virtual void Read(const std::vector< uint64_t > &memorypos, boost::intrusive_ptr< RRNamedMultiDimArray< T > > &buffer, const std::vector< uint64_t > &bufferpos, const std::vector< uint64_t > &count)
Read a block from a multidimensional array memory.
Definition: MemoryMember.h:1465
NamedMultiDimArrayMemory(const boost::intrusive_ptr< RRNamedMultiDimArray< T > > &multimemory)
Construct a new NamedMultiDimArrayMemory instance attached to an RRNamedMultiDimArrayPtr<T>
Definition: MemoryMember.h:1425
NamedMultiDimArrayMemory()
Construct a new NamedMultiDimArrayMemory instance.
Definition: MemoryMember.h:1414
RR_OVIRTUAL std::vector< uint64_t > Dimensions() RR_OVERRIDE
Dimensions of the memory array.
Definition: MemoryMember.h:1444
Exception thrown when an attempt to acces an array or container index is out of range.
Definition: Error.h:870
Single dimensional pod random access memory region.
Definition: MemoryMember.h:774
virtual void Read(uint64_t memorypos, boost::intrusive_ptr< RRPodArray< T > > &buffer, uint64_t bufferpos, uint64_t count)
Read a segment from an array memory.
Definition: MemoryMember.h:819
virtual void Write(uint64_t memorypos, const boost::intrusive_ptr< RRPodArray< T > > &buffer, uint64_t bufferpos, uint64_t count)
Write a segment to an array memory.
Definition: MemoryMember.h:835
virtual void Attach(const boost::intrusive_ptr< RRPodArray< T > > &memory)
Attach PodArrayMemory instance to an RRPodArrayPtr<T>
Definition: MemoryMember.h:805
PodArrayMemory()
Construct a new PodArrayMemory instance.
Definition: MemoryMember.h:787
RR_OVIRTUAL uint64_t Length() RR_OVERRIDE
Return the length of the array memory.
Definition: MemoryMember.h:812
PodArrayMemory(const boost::intrusive_ptr< RRPodArray< T > > &memory)
Construct a new PodArrayMemory instance attached to an RRPodArrayPtr<T>
Definition: MemoryMember.h:798
Multidimensional pod random access memory region.
Definition: MemoryMember.h:977
virtual void Read(const std::vector< uint64_t > &memorypos, boost::intrusive_ptr< RRPodMultiDimArray< T > > &buffer, const std::vector< uint64_t > &bufferpos, const std::vector< uint64_t > &count)
Read a block from a multidimensional array memory.
Definition: MemoryMember.h:1041
virtual void Attach(const boost::intrusive_ptr< RRPodMultiDimArray< T > > &multimemory)
Attach PodMultiDimArrayMemory instance to an RRPodMultiDimArrayPtr<T>
Definition: MemoryMember.h:1013
PodMultiDimArrayMemory()
Construct a new PodMultiDimArrayMemory instance.
Definition: MemoryMember.h:990
RR_OVIRTUAL uint64_t DimCount() RR_OVERRIDE
The number of dimensions in the memory array.
Definition: MemoryMember.h:1034
PodMultiDimArrayMemory(const boost::intrusive_ptr< RRPodMultiDimArray< T > > &multimemory)
Construct a new PodMultiDimArrayMemory instance attached to an RRPodMultiDimArrayPtr<T>
Definition: MemoryMember.h:1001
virtual void Write(const std::vector< uint64_t > &memorypos, const boost::intrusive_ptr< RRPodMultiDimArray< T > > &buffer, const std::vector< uint64_t > &bufferpos, const std::vector< uint64_t > &count)
Write a segment to a multidimensional array memory.
Definition: MemoryMember.h:1051
RR_OVIRTUAL std::vector< uint64_t > Dimensions() RR_OVERRIDE
Dimensions of the memory array.
Definition: MemoryMember.h:1020
Numeric primitive or character array value type.
Definition: DataTypes.h:580
Numeric primitive multidimensional array value type.
Definition: DataTypes.h:1600
namedarray array value type
Definition: DataTypes.h:2269
namedarray multidimensional array value type
Definition: DataTypes.h:2455
pod array value type
Definition: DataTypes.h:1887
std::vector< T >::size_type size_type
Definition: DataTypes.h:1917
pod multidimensional array value type
Definition: DataTypes.h:2040