Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
N
NADS_DDSLIB
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
CI / CD
CI / CD
Pipelines
Schedules
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
NADS-Public
NADS_DDSLIB
Commits
dbef1c96
Commit
dbef1c96
authored
Feb 12, 2020
by
IOWA\dheitbri
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added set by string, assumes space delimited. fixed issue with order of op for short->getPub.
parent
ef6cd13e
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
56 additions
and
3 deletions
+56
-3
NadsDDSLib.h
include/NadsDDSLib/NadsDDSLib.h
+7
-0
nadsddslib.cpp
src/nadsddslib.cpp
+49
-3
No files found.
include/NadsDDSLib/NadsDDSLib.h
View file @
dbef1c96
...
...
@@ -18,6 +18,7 @@
///
#ifndef NO_AUTOLINK_NADS_DDS_LIB
#ifdef _MSC_VER
#pragma comment(lib, "Ws2_32.lib")
#ifdef _DEBUG
#ifdef _X86_
#ifndef NADSDDDS_DLL
...
...
@@ -284,6 +285,7 @@ namespace NADSDDS {
size_t
SizeInBytes
();
size_t
Count
();
virtual
void
Publish
()
=
0
;
virtual
void
Set
(
const
std
::
string
&
)
=
0
;
protected
:
virtual
CellRoot
*
GetPub
()
=
0
;
CPublication
()
{};
...
...
@@ -296,6 +298,7 @@ namespace NADSDDS {
DoublePublication
&
operator
=
(
double
);
double
&
operator
[]
(
size_t
);
virtual
void
Publish
()
override
;
virtual
void
Set
(
const
std
::
string
&
)
override
;
private
:
virtual
CellRoot
*
GetPub
()
override
;
TDoublePubPtr
_ref
;
...
...
@@ -308,6 +311,7 @@ namespace NADSDDS {
FloatPublication
&
operator
=
(
float
);
float
&
operator
[]
(
size_t
);
virtual
void
Publish
()
override
;
virtual
void
Set
(
const
std
::
string
&
)
override
;
private
:
virtual
CellRoot
*
GetPub
()
override
;
TFloatPubPtr
_ref
;
...
...
@@ -320,6 +324,7 @@ namespace NADSDDS {
ShortPublication
&
operator
=
(
short
);
short
&
operator
[]
(
size_t
);
virtual
void
Publish
()
override
;
virtual
void
Set
(
const
std
::
string
&
)
override
;
private
:
virtual
CellRoot
*
GetPub
()
override
;
TShortPubPtr
_ref
;
...
...
@@ -332,6 +337,7 @@ namespace NADSDDS {
IntPublication
&
operator
=
(
int
);
int
&
operator
[]
(
size_t
);
virtual
void
Publish
()
override
;
virtual
void
Set
(
const
std
::
string
&
)
override
;
private
:
virtual
CellRoot
*
GetPub
()
override
;
TIntPubPtr
_ref
;
...
...
@@ -344,6 +350,7 @@ namespace NADSDDS {
CharPublication
&
operator
=
(
const
std
::
string
&
);
char
&
operator
[]
(
size_t
);
virtual
void
Publish
()
override
;
virtual
void
Set
(
const
std
::
string
&
)
override
;
private
:
virtual
CellRoot
*
GetPub
()
override
;
TCharPubPtr
_ref
;
...
...
src/nadsddslib.cpp
View file @
dbef1c96
...
...
@@ -69,6 +69,17 @@ double* DoublePublication::asDouble() {
void
DoublePublication
::
Publish
()
{
(
_ref
)
->
get
()
->
Send
();
}
void
DoublePublication
::
Set
(
const
std
::
string
&
str
){
stringstream
converter
(
str
);
double
val
;
converter
>>
val
;
int
size
=
Count
();
for
(
int
i
=
0
;
i
<
size
;
i
++
)
{
converter
>>
val
;
(
*
this
)[
i
]
=
val
;
}
}
DoublePublication
&
DoublePublication
::
operator
=
(
double
val
)
{
TypeDouble
&
dval
=
_ref
->
get
()
->
data
;
dval
.
data
()[
0
]
=
val
;
...
...
@@ -114,7 +125,16 @@ void FloatPublication::Publish() {
(
_ref
)
->
get
()
->
Send
();
}
void
FloatPublication
::
Set
(
const
std
::
string
&
str
)
{
stringstream
converter
(
str
);
float
val
;
converter
>>
val
;
int
size
=
Count
();
for
(
int
i
=
0
;
i
<
size
;
i
++
)
{
converter
>>
val
;
(
*
this
)[
i
]
=
val
;
}
}
ShortPublication
::
ShortPublication
(
TShortPubPtr
&&
ptr
)
:
_ref
(
std
::
move
(
ptr
))
{}
short
*
ShortPublication
::
asShort
()
{
...
...
@@ -135,12 +155,21 @@ short& ShortPublication::operator[] (size_t index) {
}
CellRoot
*
ShortPublication
::
GetPub
()
{
return
(
CellPub
<
TypeShort
>*
)
_ref
.
get
();
return
_ref
->
get
();
}
void
ShortPublication
::
Publish
()
{
(
_ref
)
->
get
()
->
Send
();
}
void
ShortPublication
::
Set
(
const
std
::
string
&
str
)
{
stringstream
converter
(
str
);
short
val
;
converter
>>
val
;
int
size
=
Count
();
for
(
int
i
=
0
;
i
<
size
;
i
++
)
{
converter
>>
val
;
(
*
this
)[
i
]
=
val
;
}
}
IntPublication
::
IntPublication
(
TIntPubPtr
&&
ptr
)
:
_ref
(
std
::
move
(
ptr
))
{}
int
*
IntPublication
::
asInt
()
{
...
...
@@ -159,6 +188,16 @@ int& IntPublication::operator[] (size_t index) {
}
return
nothing
;
}
void
IntPublication
::
Set
(
const
std
::
string
&
str
)
{
stringstream
converter
(
str
);
int
val
;
converter
>>
val
;
int
size
=
Count
();
for
(
int
i
=
0
;
i
<
size
;
i
++
)
{
converter
>>
val
;
(
*
this
)[
i
]
=
val
;
}
}
CellRoot
*
IntPublication
::
GetPub
()
{
return
_ref
->
get
();
...
...
@@ -187,6 +226,13 @@ char& CharPublication::operator[] (size_t index) {
return
nothing
;
}
void
CharPublication
::
Set
(
const
std
::
string
&
str
)
{;
int
size
=
min
(
Count
(),
str
.
size
());
for
(
int
i
=
0
;
i
<
size
;
i
++
)
{
(
*
this
)[
i
]
=
str
[
i
];
}
}
CellRoot
*
CharPublication
::
GetPub
()
{
return
_ref
->
_ref
.
get
();
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment