Devices

Overview

Rather than provide a complex inheritable family of classes with super-imposed mixins to represent the varying degrees of generic device functionalities (e.g. source, sink, seekable...) a rather more simpler (and faster) concept based method is used for the devices in ecl's input-output library. The concepts are required to validate the classes for use by higher level structures such as streams.

CompilingLinking

Include the following at the top of any translation unit for which you are running compile time checks on your blueprint classes.

Since it only uses macros and templatised objects, no linking is required for just this feature.

Concept Definition

InputCharDevice

An input device class has to satisfy the following conditions:

OutputCharDevice

An output device class has to satisfy the following conditions:

InputOutputCharDevice

An input-output device class has to satisfy the conditions required by both input and output devices simultaneously.

ByteDevice

The three byte device concepts are similar except they add additional read/write capabilities for the other is_byte types (refer to ecl_mpl's type traits). Namely char, signed char and unsigned char.

Usage

Generally, you won't need to use these directly. Rather they're embedded in other ecl objects such as streams. However, a simple example of a device function definition and the concept check usage is outlined below.

#include <ecl/concepts/devices.hpp>

using ecl::InputCharDevice;

template <typename Device>
class MyStream {
public:
    
    MyStream(Device *device) {
        compile_time_concept_check(InputCharDeviceConcept<Device>);
    }
};


ecl_concepts
Author(s): Daniel Stonier
autogenerated on Sun Oct 5 2014 23:35:23