Nuke binary plugins 14.1.5
 
Loading...
Searching...
No Matches
DD::Image::ChannelSet Class Reference

#include <ChannelSet.h>

Public Member Functions

 ChannelSet (ChannelSetInit v)
 
 ChannelSet (Channel v)
 
 ChannelSet (const Channel *array, int n)
 
 ChannelSet (const ChannelSet &source)
 
 ChannelSet (ChannelSet &&source)
 
const ChannelSetoperator= (const ChannelSet &source)
 
const ChannelSetoperator= (ChannelSetInit source)
 
const ChannelSetoperator= (Channel z)
 
const ChannelSetoperator= (ChannelSet &&source)
 
void swap (ChannelSet &source)
 
void clear ()
 
 operator bool () const
 
bool empty () const
 
void append (DD::Image::Hash &hash) const
 
bool all () const
 
bool operator== (const ChannelSet &source) const
 
bool operator!= (const ChannelSet &source) const
 
bool operator< (const ChannelSet &source) const
 
bool operator== (ChannelSetInit v) const
 
bool operator!= (ChannelSetInit v) const
 
bool operator== (Channel z) const
 
bool operator!= (Channel z) const
 
void operator+= (const ChannelSet &source)
 
void operator+= (ChannelSetInit source)
 
void operator+= (Channel z)
 
void insert (Channel z)
 
void insert (const Channel *array, int n)
 
void operator-= (const ChannelSet &source)
 Turn off all the channels in source.
 
void operator-= (ChannelSetInit source)
 
void operator-= (Channel z)
 
void erase (Channel z)
 
void erase (const Channel *array, int n)
 
void operator&= (const ChannelSet &source)
 
void operator&= (ChannelSetInit source)
 
void operator&= (Channel z)
 
template<class Type >
ChannelSet operator+ (const Type &z) const
 
template<class Type >
ChannelSet operator- (const Type &z) const
 
template<class Type >
ChannelSet intersection (const Type &z) const
 Return the intersection of this ChannelSet with another as a ChannelSet.
 
bool operator& (const ChannelSet &c) const
 
bool operator& (ChannelSetInit c) const
 
bool operator& (Channel z) const
 
unsigned count (Channel z) const
 
ChannelSetInit bitwiseAnd (ChannelSetInit lOther)
 
bool contains (const ChannelSet &source) const
 
bool contains (ChannelSetInit source) const
 
bool contains (Channel z) const
 This is the same as *this&z except it returns true for Chan_Black.
 
void addBrothers (Channel, unsigned n)
 
unsigned size () const
 
Channel first () const
 
Channel next (Channel k) const
 
Channel last () const
 
Channel previous (Channel k) const
 
bool operator& (int c) const
 
unsigned value () const
 

Related Functions

(Note that these are not member functions.)

typedef const ChannelSetChannelMask
 
const int Chan_Last
 
#define foreach(VAR, CHANNELS)
 
std::ostream & operator<< (std::ostream &, const ChannelSet &)
 

Detailed Description

A set of zero or more DD::Image::Channel numbers. This set cannot contains Chan_Black (zero). As these sets are used in many places in Nuke, they are designed to be as fast and small as possible.

Member Function Documentation

◆ all()

bool DD::Image::ChannelSet::all ( ) const
inline

A ChannelSet can store an infinite number of channels, where all channels after the last one that has been turned off are considered "on". This allows a set to be inverted, and to make a set that can be intersected with any other set and not change it.

The only way to get a ChannelSet into this state is to assign or initialize with the Mask_All constant, or if you += an all() set. It will stay in this state until you intersect with a non-all() set or you -= an all() set.

Some functions, in particular first(), next(), last(), and size(), do not work when all() is true and return undefined results.

Referenced by DD::Image::Write::_request(), DD::Image::Iop::_validate(), DD::Image::Write::_validate(), contains(), DD::Image::Write::engine(), last(), operator&(), operator&=(), operator+=(), operator-=(), DD::Image::MaterialOpI::overrideShaderDescInput(), and size().

◆ operator<()

bool ChannelSet::operator< ( const ChannelSet source) const

This is an arbitrary sorting that is used so that a ChannelSet can be put into an stl set.

◆ operator+=()

void ChannelSet::operator+= ( const ChannelSet source)

Turn on all the channels in source. This may more sense if it was operator|=, but calling it += allows -= to be used symetrically.

References all(), and MIN().

◆ operator&=()

void ChannelSet::operator&= ( const ChannelSet source)

In-place intersection. Only the channels that were in both sets remain in the new set.

References all(), and MIN().

◆ operator&()

bool ChannelSet::operator& ( const ChannelSet c) const

Returns true if the intersection is not empty. This returns a bool, not a ChannelSet, because almost all uses of this are in if statements conditions.

References all(), and MIN().

◆ contains()

bool ChannelSet::contains ( const ChannelSet source) const

◆ addBrothers()

void ChannelSet::addBrothers ( Channel  channel,
unsigned  n 
)

Same as "for (i=0; i<n; i++) *this += DD::Image::brother(channel,i);" but it may be more efficient.

Referenced by DD::Image::PlanarI::getPlaneFromChannel().

◆ size()

◆ first()

Channel DD::Image::ChannelSet::first ( ) const
inline

Returns the first channel in the set. Returns Chan_Black if the set is empty. Does not work if all() is true.

◆ next()

Channel DD::Image::ChannelSet::next ( Channel  k) const
inline

Returns the first channel in the set that is greater than k. Returns Chan_Black if there is none. Does not work if all() is true.

◆ last()

Channel ChannelSet::last ( ) const

Returns the last channel in the set. Returns Chan_Black if it is empty. Does not work if all() is true.

References all().

Referenced by DD::Image::ChannelMap::ChannelMap(), and previous().

◆ previous()

Channel ChannelSet::previous ( Channel  k) const

Returns the last channel before k in the set. k must not be Chan_Black. Returns Chan_Black if there is none. Does not work if all() is true.

References last().

Friends And Related Function Documentation

◆ ChannelMask

typedef const ChannelSet& ChannelMask
related

This typedef makes most method prototypes source-code compatible:

◆ Chan_Last

const int Chan_Last
related

Constant for the highest Channel number that will be produced by Nuke. This can be used to declare a fixed-size array that will be indexed by channel. You can either declare the array to have a size of Chan_Last+1, or of a size Chan_Last and subtract 1 from the Channel to index it (thus removing the Chan_Black entry at 0).

This is quite large and you should try to make a variable-sized array if possible (use ChannelSet::last() to find the last channel number instead).

◆ foreach

#define foreach (   VAR,
  CHANNELS 
)
related

Runs the body of the loop with the local variable named VAR set to each channel in the ChannelSet.

You should use the foreach() macro to go through all the channels in a set, as in this example:

foreach(z, row.channels) process(row[z]+x, r-x);

◆ operator<<()

std::ostream & operator<< ( std::ostream &  ,
const ChannelSet  
)
related

Prints which channels are in the set as the smallest possible list of layer names and channel names. If all the channels in a layer are on, it prints that layer, else it prints the channel names.

Prints "none" for the empty set, and "all except ..." for a set with the "all" bit set.



©2024 The Foundry Visionmongers, Ltd. All Rights Reserved.
www.foundry.com