NO FRAMES

Class IloCsvTableReader

Definition file: ilconcert/ilocsvreader.h
Reads a csv table with format.

An instance of IloCsvTableReader is used to read a table of comma-separated values (csv) with a specified format.

An instance is built using a pointer to an implementation class of IloCsvReader, which must be created first.

Constructor and Destructor Summary
public IloCsvTableReader()
public IloCsvTableReader(IloCsvTableReaderI * impl)
public IloCsvTableReader(const IloCsvTableReader & csv)
public IloCsvTableReader(IloCsvReaderI * csvReaderImpl, const char * name=0)
Method Summary
public voidend()
public IloCsvLinegetCurrentLine() const
public IloEnvgetEnv() const
public IloCsvTableReaderI *getImpl() const
public IloCsvLinegetLineByKey(IloInt numberOfKeys, const char *, ...)
public IloCsvLinegetLineByNumber(IloInt i)
public const char *getNameOfTable() const
public IloIntgetNumberOfColumns()
public IloIntgetNumberOfItems()
public IloIntgetNumberOfKeys() const
public IloIntgetPosition(const char *) const
public IloBoolisHeadingExists(const char * headingName) const
public voidoperator=(const IloCsvTableReader & csv)
public IloBoolprintKeys() const
Inner Class
IloCsvTableReader::LineIterator Line-iterator for csv table readers.
Constructor and Destructor Detail

IloCsvTableReader

public IloCsvTableReader()

This constructor creates a table csv reader object whose handle pointer is null. This object must be assigned before it can be used.


IloCsvTableReader

public IloCsvTableReader(IloCsvTableReaderI * impl)

This constructor creates a handle object (an instance of IloCsvReader) from a pointer to an implementation object (an instance of the class IloCsvReaderI).


IloCsvTableReader

public IloCsvTableReader(const IloCsvTableReader & csv)

This copy constructor creates a handle from a reference to a table csv reader object.

The table csv reader object and csv both point to the same implementation object.


IloCsvTableReader

public IloCsvTableReader(IloCsvReaderI * csvReaderImpl, const char * name=0)

This constructor creates a table csv reader object using the implementation class of a csv reader csvimpl. The second argument is the name of the table.


Method Detail

end

public void end()

This member function deallocates the memory used by the table csv reader.

If you no longer need the table csv reader, calling this member function can reduce memory consumption.


getCurrentLine

public IloCsvLine getCurrentLine() const

This member function returns the last line read using getLineByKey or getLineByNumber.


getEnv

public IloEnv getEnv() const

This member function returns the environment object corresponding to the invoking table csv reader.


getImpl

public IloCsvTableReaderI * getImpl() const

This member function returns a pointer to the implementation object corresponding to the invoking table csv reader.


getLineByKey

public IloCsvLine getLineByKey(IloInt numberOfKeys, const char *, ...)

This member function takes numberOfKeys arguments. These arguments are used as one key to identify a line. If the specified number of keys is less than the number of keys of the table, this member function throws an exception.

Otherwise, it returns an instance of IloCsvLine representing the line having (key1, key2, ...) in the data file.


getLineByNumber

public IloCsvLine getLineByNumber(IloInt i)

This member function returns an instance of IloCsvLine representing the line number i in the data file if it exists. Otherwise, it throws an exception.

Each time getLineByNumber or getLineByKey is called, the previous line read by one of those methods is deleted.


getNameOfTable

public const char * getNameOfTable() const

This member function returns the name of the table.


getNumberOfColumns

public IloInt getNumberOfColumns()

This member function returns the number of columns in the table. If the first column contains the name of the table, it is ignored.


getNumberOfItems

public IloInt getNumberOfItems()

This member function returns the number of lines of the table excluding blank lines, commented lines, and the header line.

Note
This member function can be used only if isMultiTable has the value IloFalse.

getNumberOfKeys

public IloInt getNumberOfKeys() const

This member function returns the number of keys in the table.


getPosition

public IloInt getPosition(const char *) const

This member function returns the position (column number) of headingName in the table.


isHeadingExists

public IloBool isHeadingExists(const char * headingName) const

This member function returns IloTrue if the column header named headingName exists. Otherwise, it returns IloFalse.


operator=

public void operator=(const IloCsvTableReader & csv)

This operator assigns an address to the handle pointer of the invoking table csv reader.

This address is the location of the implementation object of the argument csv.

After execution of this operator, the invoking table csv reader and csv both point to the same implementation object.


printKeys

public IloBool printKeys() const

This member function prints the column headers of keys if they exist. Otherwise, it prints the column numbers of keys.