open_control


Any I/O class with a constructor that takes an os_open_t parameter can be constructed to either access an existing object in the system or create a new object. A parameter of this type accepts either an os_open_control object or a bitwise-OR of the following flags.

Library

IO<ToolKit>

Declaration

#include <ospace/io/openctrl.h>

class os_open_control

Enums

enum os_open_control::type_t
  {
  create_new,
  create_always,
  open_existing,
  open_always,
  truncate_existing
  };
  

Interface

Constructor
os_open_control( os_open_t control )
Constructs a value that has encoded bits control (default os_open_control::open_existing ).
Constructor
os_open_control( const os_open_control& control )
Constructs a value equal to control .
<
bool operator<( const os_open_control& control ) const
Returns true if this value is less than control .
=
os_open_control& operator=( const os_open_control& control )
Assigns this value from control .
=
os_open_control& operator=( os_open_t control )
Assigns this value from control .
==
bool operator==( const os_open_control& control ) const
Returns true if this value is the same as control .
(os_open_t)
operator os_open_t() const
Returns the encoded control value.
create
void create( bool flag )
Sets creation to flag .
create
bool create() const
Returns true if creation is enabled. The I/O object is created if it does not already exist.
exclusive
void exclusive( bool flag )
Sets exclusive creation to flag .
exclusive
bool exclusive() const
Returns true if exclusive creation is enabled. If creation and exclusive creation are enabled and the I/O object already exists, the creation fails.
get_flags
bool get_flags( os_open_t mask ) const
Returns true if the flags specified by mask are set.
print
void print( ostream& stream ) const
Prints the object to stream .
set_flags
void set_flags( os_open_t mask , bool state )
Sets the flags specified by mask to state (default true ).
truncate
bool truncate() const
Returns true if truncation is enabled. If truncation is enabled, and the I/O object already exists and is writable, all of the object's previous data is deleted when the object is opened.
truncate
void truncate( bool flag )
Sets truncation to flag . This flag has no meaning or effect for FIFOs and special files.
value
os_open_t value() const
Returns the encoded control value.
value
void value( os_open_t control )
Sets the encoded control value to control .

Non-Member Functions

<<
ostream& operator<<( ostream& stream , const os_open_control& control )
Prints control to stream .

Universal Streaming Service

#include <ospace/uss/io.h>

<<
os_bstream& operator<<( os_bstream& stream , const os_open_control& control )
Writes control to stream .
>>
os_bstream& operator>>( os_bstream& stream , os_open_control& control )
Reads control from stream .

Copyright©1994-2026 Recursion Software LLC
All Rights Reserved - For use by licensed users only.