Skip to content

Commit

Permalink
Squashed 'externals/coda-oss/' changes from a4c9552..cab618a
Browse files Browse the repository at this point in the history
cab618a Merge pull request #237 from mdaus/read_utils
c28be7c Adding documentation
8574edd Adding convenience read functions
187d011 Updated documentation
6618a58 Updating InputStream / OutputStream interface to let you send in void* and to verify full reads
96cb50c Merge pull request #236 from mdaus/fix_work_sharing_runnable
a5505c6 Missed incrementing threadNum
ffb0da0 Fixed bug that occurred when the ThreadPlanner chose fewer threads than were provided
97aa2a6 The WithCopies() version needs to call the version that takes in a vector, not itself
d64d9d1 Merge pull request #235 from mdaus/range-num-shared-elements
7005250 add unittest for types::Range
057a359 add missing algorithms header
141e4d8 add getNumSharedElements method to types::Range
3da4060 Merge pull request #234 from mdaus/updateSwig
96d0968 Update SWIG-generated code to 3.0.12
935fb41 Merge pull request #233 from mdaus/outputByteSwap
3664e35 Review fixes
8aa5dfd Add byteswap overload if you don't want to do it in-place
b760b72 Merge pull request #232 from mdaus/range-empty-method
48b779d Range type empty method
ec2df5d Merge pull request #231 from mdaus/mt-balanced-runnables
ee6e397 remove fill call
ee025cb remove algorithm header
9f6e237 update balanced runnable unit tests according to pr comments
3ec8e60 update runnable classes/interfaces according to pr comments
41a75ce repeated word
bd564ae doxygen
0349424 make sure single threaded runnables work correctly
0a63e3f SharedWork -> WorkSharing
cc2bbb9 clean up
cbd11c9 unit tests
a35739b add work sharing balanced runnable and interfaces
1067d0f Add balanced runnable and interfaces to mt
10e9a58 add range type
ca55fe2 Merge pull request #230 from mdaus/add_const_overloadings
ab83181 Adding const overloadings
fb46a95 Merge pull request #229 from mdaus/exceptionFix
8087809 Fix exception message for unrecognizable data type
52b45ab Merge pull request #228 from mdaus/fix_thread_planner_div0
4700969 Guarding against dividing / modulo'ing by 0
bb59e90 Merge pull request #227 from mdaus/remove_fftw
ff39d7e Removing FFTW driver
389c802 Merge pull request #225 from mdaus/numpyErrorHandling
2ca7d01 Check for errors with using the C Numpy API
8840be9 Merge pull request #224 from mdaus/pseudoInverse
92a8dae Comment out main paraemeters; clarify comments
bdd43a8 Fix terminology
007ced2 Removed unused include
e7a4504 Add function for computing pseudo-inverse
cb21b99 Merge pull request #223 from mdaus/add_xml_str_replacement
d7c5f1f Using actual escape characters for newline and carriage return
92f995d Moving utility function that knows how to escape XML characters into the str module rather than buried in the XMLFormatter in the logger.  Added a unittest.
f3d0c16 Merge pull request #222 from mdaus/solarisFix
d21cbe5 Include files in proper location
6cea3b6 Ensure proper includes
db80a51 Fix includes and formatting
6248f89 Move isNaN back to header
1dd4780 Check for std::isnan during config
3e62445 Use std::isnan if available
09e1e5b Move implementation of isNaN to Utilities.cpp
b71169d Remove std:: from isnan
2adc4f1 Remove <cmath> from TestCase.h
78da5c9 isnan -> std::isnan
70df131 Merge pull request #221 from mdaus/fixConstants
c8d7744 Reformat
3276870 Close struct

git-subtree-dir: externals/coda-oss
git-subtree-split: cab618a307c02858236abfe570a0394682ecb053
  • Loading branch information
asylvest committed Nov 28, 2017
1 parent 73f5b0b commit c0fe5b6
Show file tree
Hide file tree
Showing 106 changed files with 3,510 additions and 2,471 deletions.
7 changes: 0 additions & 7 deletions modules/c++/dbi/tests/SQLTest2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,6 @@ int main(int argc, char* argv[])

resultSet = myConn->query("CREATE TABLE MyTable (id INT NOT NULL PRIMARY KEY, name VARCHAR(25) NOT NULL, description TEXT NOT NULL)");

char document[5];
document[0] = 'J';
document[1] = 'E';
document[2] = '\0';
document[3] = 'F';
document[4] = 'F';

resultSet = myConn->query("SELECT TMODEL_KEY, NAME, OVERVIEW_URL FROM TMODEL");

myRow = resultSet->fetchRow();
Expand Down
25 changes: 13 additions & 12 deletions modules/c++/io/include/io/ByteStream.h
Original file line number Diff line number Diff line change
Expand Up @@ -92,21 +92,11 @@ class ByteStream : public SeekableInputStream, public SeekableOutputStream

/*!
* Writes the bytes in data to the stream.
* \param b the data to write to the stream
* \param buffer the data to write to the stream
* \param size the number of bytes to write to the stream
*/
virtual
void write(const sys::byte *b, sys::Size_T size);

/*!
* Read up to len bytes of data from this buffer into an array
* update the mark
* \param b Buffer to read into
* \param len The length to read
* \throw IoException
* \return The number of bytes read
*/
virtual sys::SSize_T read(sys::byte *b, sys::Size_T len);
void write(const void* buffer, size_t size);

void reset()
{
Expand Down Expand Up @@ -137,6 +127,17 @@ class ByteStream : public SeekableInputStream, public SeekableOutputStream
return mData.size();
}

protected:
/*!
* Read up to len bytes of data from this buffer into an array
* update the mark
* \param buffer Buffer to read into
* \param len The length to read
* \throw IoException
* \return The number of bytes read
*/
virtual sys::SSize_T readImpl(void* buffer, size_t len);

private:
std::vector<sys::ubyte> mData;
sys::Off_T mPosition;
Expand Down
8 changes: 6 additions & 2 deletions modules/c++/io/include/io/CountingStreams.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,13 @@ class CountingOutputStream: public ProxyOutputStream

using ProxyOutputStream::write;

virtual void write(const sys::byte* b, sys::Size_T len)
/*!
* \param buffer The byte array to write to the stream
* \param len The length of the byte array to write to the stream
*/
virtual void write(const void* buffer, size_t len)
{
ProxyOutputStream::write(b, len);
ProxyOutputStream::write(buffer, len);
mByteCount += len;
}

Expand Down
23 changes: 12 additions & 11 deletions modules/c++/io/include/io/DataStream.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,22 +62,12 @@ class DataStream: public io::Serializable
return mStringStream.available();
}

/*!
* Read bytes from our byte stream into the buffer
* \param data The data buffer to read to
* \param size The size of the data buffer to read
*/
virtual sys::SSize_T read(sys::byte* data, sys::Size_T size)
{
return mStringStream.read(data, size);
}

/*!
* Write bytes from into our byte stream from the buffer
* \param data The data buffer to read from
* \param size The size of the data buffer.
*/
virtual void write(const sys::byte* data, sys::Size_T size)
virtual void write(const void* data, sys::Size_T size)
{
mStringStream.write(data, size);
}
Expand Down Expand Up @@ -108,7 +98,18 @@ class DataStream: public io::Serializable
{
return mStringStream;
}

protected:
/*!
* Read bytes from our byte stream into the buffer
* \param data The data buffer to read to
* \param size The size of the data buffer to read
*/
virtual sys::SSize_T readImpl(void* data, sys::Size_T size)
{
return mStringStream.read(data, size);
}

io::StringStream mStringStream;
};
}
Expand Down
6 changes: 3 additions & 3 deletions modules/c++/io/include/io/DbgStream.h
Original file line number Diff line number Diff line change
Expand Up @@ -85,15 +85,15 @@ class DbgStream : public OutputStream
/*!
* This method uses the bound OutputStream to print,
* if the switch is on.
* \param b The byte array to write to the stream
* \param buffer The byte array to write to the stream
* \param len The length
* \throw IOException
*/
virtual void write(const sys::byte* b, sys::Size_T len)
virtual void write(const void* buffer, sys::Size_T len)
{
if (mOn)
{
mStream->write(b, len);
mStream->write(buffer, len);
}
}

Expand Down
24 changes: 13 additions & 11 deletions modules/c++/io/include/io/FileInputStreamIOS.h
Original file line number Diff line number Diff line change
Expand Up @@ -121,17 +121,6 @@ class FileInputStreamIOS : public SeekableInputStream

//! Close the file
void close();
//using InputStream::read;
/*!
* Read up to len bytes of data from input stream into an array
*
* \param b Buffer to read into
* \param len The length to read
* \throw except::IOException
* \return The number of bytes read
*
*/
virtual sys::SSize_T read(sys::byte* b, sys::Size_T len);

/*!
* Access the stream directly
Expand All @@ -141,7 +130,20 @@ class FileInputStreamIOS : public SeekableInputStream
{
return mFStream;
}

protected:
/*!
* Read up to len bytes of data from input stream into an array
*
* \param buffer Buffer to read into
* \param len The length to read
* \throw except::IOException
* \return The number of bytes read
*
*/
virtual sys::SSize_T readImpl(void* buffer, size_t len);


std::ifstream mFStream;
};

Expand Down
10 changes: 4 additions & 6 deletions modules/c++/io/include/io/FileInputStreamOS.h
Original file line number Diff line number Diff line change
Expand Up @@ -154,21 +154,19 @@ class FileInputStreamOS : public SeekableInputStream
mFile.close();
}

protected:
/*!
* Read up to len bytes of data from input stream into an array
*
* \param b Buffer to read into
* \param buffer Buffer to read into
* \param len The length to read
* \throw except::IOException
* \return The number of bytes read
*
*/
virtual sys::SSize_T read(sys::byte* b, sys::Size_T len);

virtual sys::SSize_T readImpl(void* buffer, size_t len);
};



}

#endif
#endif
4 changes: 2 additions & 2 deletions modules/c++/io/include/io/FileOutputStreamIOS.h
Original file line number Diff line number Diff line change
Expand Up @@ -107,11 +107,11 @@ class FileOutputStreamIOS : public OutputStream
* This method defines a given OutputStream. By defining,
* this method, you can define the unique attributes of an OutputStream
* inheriting class.
* \param b The byte array to write to the stream
* \param buffer The byte array to write to the stream
* \param len the length of bytes to write
* \throw IoException
*/
virtual void write(const sys::byte* b, sys::Size_T len);
virtual void write(const void* buffer, size_t len);
/*!
* Access the stream directly
* \return The stream in native C++
Expand Down
7 changes: 2 additions & 5 deletions modules/c++/io/include/io/FileOutputStreamOS.h
Original file line number Diff line number Diff line change
Expand Up @@ -106,14 +106,11 @@ class FileOutputStreamOS : public SeekableOutputStream
* This method defines a given OutputStream. By defining,
* this method, you can define the unique attributes of an OutputStream
* inheriting class.
* \param b The byte array to write to the stream
* \param buffer The byte array to write to the stream
* \param len the length of bytes to write
* \throw IoException
*/
virtual void write(const sys::byte* b, sys::Size_T len);



virtual void write(const void* buffer, size_t len);
};
}

Expand Down
20 changes: 17 additions & 3 deletions modules/c++/io/include/io/InputStream.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,12 +82,17 @@ class InputStream

/*!
* Read up to len bytes of data from input stream into an array
* \param b Buffer to read into
* \param buffer Buffer to read into
* \param len The length to read
* \param verifyFullRead If set to true, checks to see if 'len' bytes
* were read and, if not, throws. Defaults to false.
* \throw IOException
* \return The number of bytes read, or -1 if EOF
* \return The number of bytes read, or -1 if EOF. If 'verifyFullRead'
* is true, this will always return 'len' bytes if it didn't throw.
*/
virtual sys::SSize_T read(sys::byte* b, sys::Size_T len) = 0;
sys::SSize_T read(void* buffer,
size_t len,
bool verifyFullRead = false);

/*!
* Read either a buffer of len size, or up until a newline,
Expand All @@ -112,6 +117,15 @@ class InputStream
virtual sys::SSize_T streamTo(OutputStream& soi,
sys::SSize_T numBytes = IS_END);

protected:
/*!
* Read up to len bytes of data from input stream into an array
* \param buffer Buffer to read into
* \param len The length to read
* \throw IOException
* \return The number of bytes read, or -1 if EOF
*/
virtual sys::SSize_T readImpl(void* buffer, size_t len) = 0;
};
}

Expand Down
7 changes: 2 additions & 5 deletions modules/c++/io/include/io/MMapInputStream.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,12 +70,9 @@ class MMapInputStream : public SeekableInputStream
return mMark;
}

virtual ssize_t read(sys::byte* b, size_t len);




protected:
virtual sys::SSize_T readImpl(void* buffer, size_t len);

virtual void _map();
virtual void _unmap();
sys::OS mOs;
Expand Down
36 changes: 17 additions & 19 deletions modules/c++/io/include/io/NullStreams.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,20 +46,6 @@ class NullInputStream : public InputStream
return mAvailable;
}

virtual sys::SSize_T read(sys::byte* b, sys::Size_T len)
{
sys::Size_T numToRead =
(mAvailable >= (sys::SSize_T) len ? len : (sys::Size_T) mAvailable);

mAvailable -= (sys::SSize_T) numToRead;

if (numToRead == 0)
throw except::IOException(Ctxt("EOF - no more data to read"));

processBytes(b, numToRead);
return numToRead;
}

virtual sys::SSize_T readln(sys::byte *cStr,
const sys::Size_T strLenPlusNullByte)
{
Expand All @@ -85,10 +71,24 @@ class NullInputStream : public InputStream
{
return (sys::byte) 0;
}
virtual void processBytes(sys::byte* b, sys::Size_T len) const
virtual void processBytes(void* buffer, sys::Size_T len) const
{
//override for different behavior
memset(b, 0, len);
memset(buffer, 0, len);
}

virtual sys::SSize_T readImpl(void* buffer, size_t len)
{
size_t numToRead =
(mAvailable >= (sys::SSize_T) len ? len : (size_t) mAvailable);

mAvailable -= (sys::SSize_T) numToRead;

if (numToRead == 0)
throw except::IOException(Ctxt("EOF - no more data to read"));

processBytes(buffer, numToRead);
return numToRead;
}
};

Expand All @@ -114,16 +114,14 @@ class NullOutputStream : public OutputStream
{
}

virtual void write(const sys::byte* , sys::Size_T )
virtual void write(const void* , size_t )
{
}

virtual void flush()
{
}

};

}

#endif
5 changes: 2 additions & 3 deletions modules/c++/io/include/io/OutputStream.h
Original file line number Diff line number Diff line change
Expand Up @@ -88,11 +88,11 @@ class OutputStream
* This method defines a given OutputStream. By defining,
* this method, you can define the unique attributes of an OutputStream
* inheriting class.
* \param b The byte array to write to the stream
* \param buffer The byte array to write to the stream
* \param len The length of the byte array to write to the stream
* \throw IOException
*/
virtual void write(const sys::byte* b, sys::Size_T len) = 0;
virtual void write(const void* buffer, size_t len) = 0;

/*!
* Flush the stream if needed
Expand All @@ -107,7 +107,6 @@ class OutputStream
virtual void close()
{
}

};
}

Expand Down
12 changes: 5 additions & 7 deletions modules/c++/io/include/io/PipeStream.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,12 +72,6 @@ class PipeStream : InputStream
return mExecPipe.closePipe();
}

/*!
* \func read
* \brief returns the requested size in bytes from the stream
*/
virtual sys::SSize_T read(sys::byte* b, sys::Size_T len);

/*!
* \func readln
* \brief returns one line ending in a newline or the requested size --
Expand All @@ -101,8 +95,12 @@ class PipeStream : InputStream
virtual sys::SSize_T streamTo(OutputStream& soi,
sys::SSize_T numBytes = IS_END);


protected:
/*!
* \brief returns the requested size in bytes from the stream
*/
virtual sys::SSize_T readImpl(void* buffer, size_t len);


sys::ExecPipe mExecPipe;
mem::ScopedArray<char> mCharString;
Expand Down
Loading

0 comments on commit c0fe5b6

Please sign in to comment.