Commit Graph

159 Commits

Author SHA1 Message Date
Michael Davidsaver
0eecd3b1fe document freeze/thaw 2013-07-29 11:44:52 -04:00
Michael Davidsaver
9ac030169a update pvD array handling
Interface only uses shared_vector<const T>
storage also uses only const.
2013-07-25 17:22:16 -04:00
Michael Davidsaver
45bb461c32 shared_vector require freeze/thaw
Remove the implicit cast from non-const to const.
Require the use of freeze/thaw when
changing between const and non-const.

Change argument of const_shared_vector_cast
to a non-const shared_vector reference
to allow it to be cleared by freeze/thaw.
2013-07-25 15:26:29 -04:00
Michael Davidsaver
5e2e7c81a6 Merge remote branch 'md/master' into pvarr
* md/master:
  added
  minor changes
  comparison between implementations
  Proposed pvData.h interface
  added pvArray.html; made queue.h and bitSetUtil.* compatible with pvDataCPP.
2013-07-09 18:37:53 -04:00
Michael Davidsaver
cff59487ae shared_vector freeze and thaw 2013-07-09 18:24:51 -04:00
Michael Davidsaver
c0e9dcff21 revise static_shared_vector_cast
Move the work into a special ctor
to allow full inline of casting wrapper

Prevent static_shared_vector_cast from
casting const <-> non-const
2013-07-09 18:24:41 -04:00
Michael Davidsaver
74f68c47d3 shared_vector_convert
Allow converting of shared_vector between types

Conversion utilizes castUnsafe<TO,FROM>().

Converting to/from void is supported.  Convert to void
is an alias for static_shared_vector_cast<void>().
Convert from void utilizes shared_vector<void>::original_type()
and throws std::runtime_error if this is not valid.

Casting now handles 'const void'
is most places where 'void' can be used.
2013-07-09 18:24:40 -04:00
Michael Davidsaver
3c7a738ffc shared_vector<void> tracks original type 2013-07-09 18:24:40 -04:00
Michael Davidsaver
22d4a53d65 create templateMeta.h
Home for common C++ template tricks
2013-07-09 18:24:40 -04:00
Michael Davidsaver
2cb07a8490 move parts of ScalarTypeFunc to sharedVector.h
Move the parts of ScalarTypeFunc which
deal with untyped shared_vector s
to sharedVector.h to allow sharedVector.h
to include pvIntrospect.h w/o creating
an include loop...
2013-07-09 10:36:48 -04:00
Michael Davidsaver
73450bdbc7 combine shared_vector<T> for void and const void 2013-07-03 14:23:17 -04:00
Michael Davidsaver
5699c43b74 correct max_size
Take into account sizeof(E).
2013-07-02 17:42:46 -04:00
Marty Kraimer
3de28e3cef added pvArray.html; made queue.h and bitSetUtil.* compatible with pvDataCPP. 2013-06-13 14:52:27 -04:00
Michael Davidsaver
4e749cc8be Improve shared_vector::push_back
push_back now allocates additional space
in powers of 2 up to 1k elements, then
in blocks of 1k elements.
2013-06-11 17:42:30 -04:00
Michael Davidsaver
70c9a7c18f simplify shared_vector ctors
Casting will be done through the copy constructor.
2013-06-11 14:39:40 -04:00
Michael Davidsaver
a4cfab1242 Fix "optimize shared_vector for storing non-POD types"
Can't move references when the source array is
still referenced by other shared_vectors
2013-06-11 14:39:40 -04:00
Michael Davidsaver
be4738f59c remove weak_vector
It seems that shared_ptr::use_count() does
not include weak_ptr instances.  Therefore
shared_ptr::use_count()==1 (aka unique())
does *not* ensure exclusive ownership!

This breaks the assumption used by
shared_vector::make_unique() to avoid
allocating a new array in some cases.
2013-06-10 15:09:42 -04:00
Michael Davidsaver
b63c3da565 add const_pointer to shared_vector 2013-06-10 12:09:29 -04:00
Michael Davidsaver
0b89f08d09 explicit copy and assignment for shared_vector
Add explicit copy constructor and
assignment operator for shared_vector.
2013-06-10 12:09:29 -04:00
Michael Davidsaver
bc3187a3f6 optimize shared_vector for storing non-POD types
pass values by reference where appropriate.
When reallocating arrays of shared_ptr
"move" with swap() instead of operator=
to avoid ref counter inc and dec for each
element.
2013-06-03 19:31:05 -04:00
Michael Davidsaver
3b6268a4fc add const_iterator to shared_vector 2013-05-31 09:58:52 -04:00
Michael Davidsaver
3cd2bfdef0 shared_vector implementation
Shared ownership of a single C array.

Tracks offset and length for each instance
allowing each owner to "view" a different
piece of the array.

Parts of shared_vector<T> which can work
for T=void are in shared_vector_base<T>.
Specializations shared_vector<void>
and shared_vector<const void> handle
un-typed arrays.

Allow casting to/from typed vector

Offsets and sizes of untyped vectors are tracked in
bytes.  Therefore casting to types where sizeof(T)>1
is undefined if the offset is not a multiple of
sizeof(T).
2013-05-08 18:21:34 -04:00
Michael Davidsaver
fd5ea89340 typo 2013-05-01 14:27:00 -04:00
Michael Davidsaver
61e8024c65 fix mapping between int* and epicsInt* types 2013-04-30 18:14:05 -04:00
Michael Davidsaver
2f8c434429 add castUnsafeV
non-template version of castUnsafe<TO>(FROM v)).
2013-04-22 11:59:20 -04:00
Michael Davidsaver
0e57391b4d vxWorks compatibility 2013-04-22 11:59:20 -04:00
Michael Davidsaver
7ff1a93e72 parseToPOD: fix 64-bit
Try again to detect if uint16_t is long or long long.
2013-04-18 13:54:04 -04:00
Michael Davidsaver
d7eada7216 type casting with castUnsafe<TO>(FROM val) 2013-04-15 14:39:42 -04:00
Matej Sekoranja
0dd6f01ef6 direct, i.e. no-copy, de/serialization support 2013-04-12 21:54:11 +02:00
Matej Sekoranja
675243061d -Wextra compiler warnings fixed 2013-02-16 12:50:36 +01:00
Marty Kraimer
4bc7e9c8fe several minor problems found while developing pvDatabaseCPP 2012-12-12 14:59:33 -05:00
Matej Sekoranja
f88f0b4a76 localStaticLock - static local thread-safety 2012-10-08 12:19:21 +02:00
Marty Kraimer
5ba0209f39 get rid of all static global objects 2012-10-03 08:59:23 -04:00
Unknown
6a378dae0d removed sprintf format warnings 2012-09-14 13:54:35 +02:00
Matej Sekoranja
4cef1135a3 PVStructure serialization fixed 2012-09-10 08:56:11 +02:00
Unknown
55df2e06e2 compatibility with vxWorks 2012-09-05 14:11:07 +02:00
Matej Sekoranja
cfc9ebefb0 merge 2012-09-03 23:46:06 +02:00
Matej Sekoranja
516518529c VxWorks ports from Dirk 2012-09-03 23:43:26 +02:00
Marty Kraimer
5e3311a024 LICENSE, COPYRIGHT, file header 2012-08-22 14:39:19 -04:00
Matej Sekoranja
978cb937c4 String const & message 2012-08-20 19:09:01 +02:00
Matej Sekoranja
86adfc091b passing string by const ref 2012-08-20 16:37:26 +02:00
Marty Kraimer
66fb300873 documentation updated; changes for Field::ID 2012-08-17 06:45:20 -04:00
Matej Sekoranja
6a86496385 added BitSet::size() 2012-07-31 11:47:42 +02:00
Matej Sekoranja
689d0875b7 null string check 2012-07-30 22:03:23 +02:00
Marty Kraimer
31922eac32 commit so that Matej can look at Monitor 2012-07-23 16:56:49 -04:00
Marty Kraimer
5dcd864c58 more shared_pointer everywhere 2012-07-17 09:23:53 -04:00
Marty Kraimer
9775fd4707 redo monotorQueue 2012-07-02 16:17:58 -04:00
Matej Sekoranja
3991a51fd6 size_t changes 2012-06-07 14:15:12 +02:00
Matej Sekoranja
770e63b8da removed BitSetPtr due to possible 4.6.1 gcc problem 2012-05-21 21:11:20 +02:00
Marty Kraimer
d320f00e96 fix messageType name 2012-05-10 06:28:27 -04:00