Aleph-w  1.9
General library for algorithms and data structures
Aleph::Bit_Fields Class Reference

#include <aleph-graph.H>

Public Member Functions

 Bit_Fields () noexcept
 All the bits are set to zero.
 
bool get_bit (int bit) const noexcept
 
void set_bit (int bit, int value) noexcept
 
unsigned int get_state () const noexcept
 Return the state value.
 
std::string str_state () const
 Return a stringficated version of state.
 
void set_state (unsigned char s) noexcept
 Set the state to the value s
 
void reset (int bit) noexcept
 Reset bit to zero.
 
void reset () noexcept
 Reset all bits and state to zero.
 

Public Attributes

unsigned int depth_first: 1
 
unsigned int breadth_first: 1
 Depth first search.
 
unsigned int test_cycle: 1
 Breadth first search.
 
unsigned int find_path: 1
 Cycle existence test.
 
unsigned int euler: 1
 Path searching (there are several types)
 
unsigned int maximum_flow: 1
 Used during eulerian searching.
 
unsigned int spanning_tree: 1
 Used by the maximum flow algorithms.
 
unsigned int build_subtree: 1
 Used by spannign tree algorithms.
 
unsigned int convert_tree: 1
 Used by subtree or subgraph building.
 
unsigned int cut: 1
 Used for Tree_Node conversion.
 
unsigned int min: 1
 Used for cut points computing.
 
unsigned int state: 2
 

Detailed Description

Bit fields for nodes and arcs used for marking visit state during processing.

Each node and arc of a graph contains a bitmask intended to mark visit state during the execution of an algorithm. The bits are named according to their use by the library.

If your you intend to use some of these bits for your own processing, then make sure of two things:

  1. Use at the most the eight first bits. Do no use other because they could be removed in future releases.
  2. Make sure that the bit that you use will no be used by an algorithm that you invoke
Note
For some reason not yet clearly understood, the bit fields copy by memcpy and other relatives does not work properly on some systems. Possibly this would only happen on little-endian systems. Therefore, do not use these mechanisms.

Member Function Documentation

◆ get_bit()

bool Aleph::Bit_Fields::get_bit ( int  bit) const
inlinenoexcept

Get a control bit.

It is recommended to use the bit name. By example

NODE_BITS(p).get_bit(Breadth_First)
Parameters
[in]bitnumber (or name) of the bit to be read
Returns
the logical value of bit
Exceptions
out_of_rangeif bit is greater or equal than Num_Bits_Graph.

◆ set_bit()

void Aleph::Bit_Fields::set_bit ( int  bit,
int  value 
)
inlinenoexcept

Set a control bit.

Set a specific control bit to zero or one.

The real value of value is not verified. Anything different than zero will be considered as 1.

Parameters
[in]bitto set
[in]valuethe value to set
Exceptions
out_of_rangeif bit is greater or equal than Num_Bits_Graph.
+ Here is the caller graph for this function:

Member Data Documentation

◆ state

unsigned int Aleph::Bit_Fields::state

Used for min path or min spanning tree Visit state.

Note that there are two bits. So you can manage 4 different states.


The documentation for this class was generated from the following file:

Leandro Rabindranath León