The first selection of a blob in the json was ok, but all
subsequent selections failed.
Issue-ID: RIC-596
Signed-off-by: E. Scott Daniels <daniels@research.att.com>
Change-Id: I8e7c4b731c15bc98654a8fb9bd052d43bd10adca
set( major_version "1" ) # should be automatically populated from git tag later, but until CI process sets a tag we use this
set( minor_version "2" )
set( major_version "1" ) # should be automatically populated from git tag later, but until CI process sets a tag we use this
set( minor_version "2" )
set( install_root "${CMAKE_INSTALL_PREFIX}" )
set( install_inc "include/ricxfcpp" )
set( install_root "${CMAKE_INSTALL_PREFIX}" )
set( install_inc "include/ricxfcpp" )
st( jw_new( jbuf ) )
{ /* empty body */ }
st( jw_new( jbuf ) )
{ /* empty body */ }
-//Jhash::Jhash( Jhash&& soi ); // mover
-//Jhash::Jhash& operator=( Jhash&& soi ); // move operator
+
+/*
+ Move constructor.
+*/
+Jhash::Jhash( Jhash&& soi ) {
+ master_st = soi.master_st;
+ st = soi.st;
+
+ soi.st = NULL; // prevent closing of RMR stuff on soi destroy
+ soi.master_st = NULL;
+}
+
+/*
+ Move Operator.
+*/
+Jhash& Jhash::operator=( Jhash&& soi ) {
+ if( this != &soi ) { // cannot do self assignment
+ master_st = soi.master_st;
+ st = soi.st;
+
+ soi.st = NULL; // prevent closing of RMR stuff on soi destroy
+ soi.master_st = NULL;
+ }
+
+ return *this;
+}
void* bst; // blob symbol table
if( master_st == NULL ) { // must capture master
void* bst; // blob symbol table
if( master_st == NULL ) { // must capture master
}
if( (bst = jw_blob( st, name )) != NULL ) {
}
if( (bst = jw_blob( st, name )) != NULL ) {
if( master_st != NULL ) {
st = master_st;
}
if( master_st != NULL ) {
st = master_st;
}
-/*
- else {
-fprintf( stderr, "bad unset pointer%p %p\n", master_st, st );
-}
-*/
}
// ---------------- debugging and sanity checks ---------------------------------------
}
// ---------------- debugging and sanity checks ---------------------------------------
public:
Jhash( const char* jblob ); // builder
public:
Jhash( const char* jblob ); // builder
- //Jhash( Message&& soi ); // mover
- //Jhash& operator=( Message&& soi ); // move operator
+ Jhash( Jhash&& soi ); // mover
+ Jhash& operator=( Jhash&& soi ); // move operator
~Jhash(); // destruction
bool Set_blob( const char* name ); // blob/root selection
~Jhash(); // destruction
bool Set_blob( const char* name ); // blob/root selection
fprintf( stderr, "<INFO> timestamp: %.10f\n", val );
fprintf( stderr, "<INFO> timestamp: %.10f\n", val );
+ // ----- jhashes can be moved, drive that logic for coverage
+ Jhash j2( "{}" );
+
+ Jhash j1 = std::move( *jh ); // drives move constructor function
+ j2 = std::move( j1 ); // drives move operator function