NO FRAMES

Class IloCsvTableReader

Definition file: ilconcert/ilocsvreader.h

An instance of IloCsvTableReader is used to read a csv table 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 *)
public IloCsvTableReader(const IloCsvTableReader &)
public IloCsvTableReader(IloCsvReaderI *, const char *)
Method Summary
public voidend()
public IloCsvLinegetCurrentLine()
public IloEnvgetEnv()
public IloCsvTableReaderI *getImpl()
public IloCsvLinegetLineByKey(IloInt, const char *, ...)
public IloCsvLinegetLineByNumber(IloInt)
public const char *getNameOfTable()
public IloIntgetNumberOfColumns()
public IloIntgetNumberOfItems()
public IloIntgetNumberOfKeys()
public IloIntgetPosition(const char *)
public IloBoolisHeadingExists(const char *)
public voidoperator=(const IloCsvTableReader &)
public IloBoolprintKeys()
Inner Class
IloCsvTableReader::LineIterator
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 * , const char * name)

This constructor creates a table csv reader object using the implementation class of a csv reader csvimpl. The second parameter 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()

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


getEnv

public IloEnv getEnv()

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


getImpl

public IloCsvTableReaderI * getImpl()

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 as parameters. These parameters 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()

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 the parameter isMultiTable has the value IloFalse.

getNumberOfKeys

public IloInt getNumberOfKeys()

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


getPosition

public IloInt getPosition(const char * )

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


isHeadingExists

public IloBool isHeadingExists(const char * headingName)

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()

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