Oracle Fusion Middleware C++ API Reference for Oracle Coherence
12c (12.1.2)

E26041-01

PartitionSet Class Reference

#include <coherence/net/partition/PartitionSet.hpp>

Inherits Object, and PortableObject.

List of all members.


Detailed Description

PartitionSet is a light-weight data structure that represents a set of partitions that are used in parallel processing.

This set quite often accompanies a result of partial parallel execution and is used to determine whether or not the entire set of partitions was successfully processed.

Note that all PartitionSet operations that take another set as an argument assume that both sets have the same partition count.

Since:
Coherence 3.7.1
Author:
tb 2011.08.12

Public Types

enum  Format { marked_none, marked_few, marked_many, marked_all }
 Serialization format indicator. More...
typedef spec::Handle Handle
 PartitionSet Handle definition.
typedef spec::View View
 PartitionSet View definition.
typedef spec::Holder Holder
 PartitionSet Holder definition.

Public Member Functions

 PartitionSet ()
 Default constructor.
virtual bool add (int32_t nPartition)
 Add the specified partition to the set.
virtual bool add (PartitionSet::View vPartitions)
 Add the specified PartitionSet to this set.
virtual void fill ()
 Fill the set to contain all the partitions.
virtual int32_t next (int32_t nPartition) const
 Return an index of the first marked partition that is greater than or equal to the specified partition.
virtual void toStream (std::ostream &out) const
 Output a human-readable description of this Object to the given stream.

coherence::lang::operator<<(std::ostream, Object::View) is defined and will call into the toStream method, to output Objects. If a managed String object is desired, the COH_TO_STRING macro can be used to build up a String from streamable contents.

 Object::View vKey   = ...
 Object::View vValue = ...
 std::cout << vKey << " = " << vValue << std::endl;

 String::Handle hs = COH_TO_STRING(vKey << " = " << vValue);

Parameters:
out the stream used to output the description

virtual void readExternal (PofReader::Handle hIn)
 
virtual void writeExternal (PofWriter::Handle hOut) const
 

Static Protected Member Functions

static int32_t getTrailingZeroCount (int64_t l)
 Determine the number of trailing zero bits in the passed long value.

Protected Attributes

int32_t m_cPartitions
 Total partition count.
FinalHandle< Array
< int64_t > > 
f_halBits
 A bit array representing the partitions, stored as an array of longs.
int64_t m_lTailMask
 A mask for the last long that indicates what bits get used.
int32_t m_cMarked
 A cached count of marked partitions; -1 indicates that the value must be recalculated.

Member Enumeration Documentation

enum Format

Serialization format indicator.

Enumerator:
marked_none  Indicates that no partitions are marked; MARKED_NONE requires no additional data.
marked_few  Indicates that a small number of partitions are marked; followed by stream of packed integers indicating gaps between each marked partition, terminated with a -1.
marked_many  Indicates that a large number of partitions are marked; followed by a sequence of 64-bit values sufficient to represent the cardinality of the PartitionSet.
marked_all  Indicates that all partitions are marked; MARKED_ALL requires no additional data.


Member Function Documentation

virtual bool add ( int32_t  nPartition  )  [virtual]

Add the specified partition to the set.

Parameters:
nPartition the partition to add
Returns:
true if the specified partition was actually added as a result of this call; false otherwise

virtual bool add ( PartitionSet::View  vPartitions  )  [virtual]

Add the specified PartitionSet to this set.

Parameters:
vPartitions the PartitionSet to add
Returns:
true if all of the partitions were actually added as a result of this call; false otherwise

virtual int32_t next ( int32_t  nPartition  )  const [virtual]

Return an index of the first marked partition that is greater than or equal to the specified partition.

If no such partition exists then -1 is returned.

This method could be used to iterate over all marked partitions:

 for (int i = ps.next(0); i >= 0; i = ps->next(i+1))
     {
     // process partition
     }
 

Parameters:
nPartition the partition to start checking from (inclusive)
Returns:
the next marked partition, or -1 if no next marked partition exists in the set
Exceptions:
IndexOutOfBoundsException if the specified partition is invalid

static int32_t getTrailingZeroCount ( int64_t  l  )  [static, protected]

Determine the number of trailing zero bits in the passed long value.

Parameters:
l a long value
Returns:
the number of trailing zero bits in the value, from 0 (indicating that the least significant bit is set) to 64 (indicating that no bits are set)


The documentation for this class was generated from the following file:
Copyright © 2000, 2013, Oracle and/or its affiliates. All rights reserved.