" columns in the CSV file '" << getColumnCount() << "'");
}
- /// @todo Apparently, seekp and seekg are interchangable. A call to seekp
+ /// @todo Apparently, seekp and seekg are interchangeable. A call to seekp
/// results in moving the input pointer too. This is ok for now. It means
/// that when the append() is called, the read pointer is moved to the EOF.
/// For the current use cases we only read a file and then append a new
bool
CSVFile::next(CSVRow& row, const bool skip_validation) {
- // Set somethings as row validation error. Although, we haven't started
+ // Set something as row validation error. Although, we haven't started
// actual row validation we should get rid of any previously recorded
// errors so as the caller doesn't interpret them as the current one.
setReadMsg("validation not started");
// Catch exceptions so as we can close the file if error occurs.
try {
// The file may fail to open. For example, because of insufficient
- // persmissions. Although the file is not open we should call close
+ // permissions. Although the file is not open we should call close
// to reset our internal pointer.
if (!fs_->is_open()) {
isc_throw(CSVFileError, "unable to open '" << filename_ << "'");
}
- // Make sure we are on the beginning of the file, so as we can parse
- // the header.
+ // Make sure we are on the beginning of the file, so as we
+ // can parse the header.
fs_->seekg(0);
if (!fs_->good()) {
isc_throw(CSVFileError, "unable to set read pointer in the file '"
close();
isc_throw(CSVFileError, "unable to open '" << filename_ << "'");
}
- // Opened successfuly. Write a header to it.
+ // Opened successfully. Write a header to it.
try {
CSVRow header(getColumnCount());
for (int i = 0; i < getColumnCount(); ++i) {
/// @brief Check if the specified index of the value is in range.
///
- /// This function is used interally by other functions.
+ /// This function is used internally by other functions.
///
/// @param at Value index.
/// @throw CSVFileError if specified index is not in range.
void checkIndex(const size_t at) const;
- /// @brief Separator character specifed in the constructor.
+ /// @brief Separator character specified in the constructor.
///
/// @note Separator is held as a string object (one character long),
/// because the boost::is_any_of algorithm requires a string, not a
/// - @c recreate - removes existing file and creates a new one.
///
/// When the file is opened its header file is parsed and column names are
-/// idenetified. At this point it is already possible to get the list of the
+/// identified. At this point it is already possible to get the list of the
/// column names using appropriate accessors. The data rows are not parsed
/// at this time. The row parsing is triggered by calling @c next function.
/// The result of parsing a row is stored in the @c CSVRow object passed as
///
/// @param Object representing a CSV file row.
///
- /// @throw CSVFileError When error occured during IO operation or if the
+ /// @throw CSVFileError When error occurred during IO operation or if the
/// size of the row doesn't match the number of columns.
void append(const CSVRow& row) const;
/// By default, the data pointer in the file is set to the beginning of
/// the first row. In order to retrieve the row contents the @c next
/// function should be called. If a @c seek_to_end parameter is set to
- /// true, the file will be opened and the interal pointer will be set
+ /// true, the file will be opened and the internal pointer will be set
/// to the end of file.
///
/// @param seek_to_end A boolean value which indicates if the intput and
/*
* \short write() that writes everything.
* Wrapper around write(). The difference is, it never writes less data
- * and looks successfull (eg. it blocks until all data are written).
+ * and looks successful (eg. it blocks until all data are written).
* Retries on signals.
*
- * \return True if sucessfull, false otherwise. The errno variable is left
+ * \return True if successful, false otherwise. The errno variable is left
* intact.
* \param fd Where to write.
* \param data The buffer to write.
///
/// The returned SocketSession object is valid only until the next time
/// this method is called or until the \c SocketSessionReceiver object is
- /// destructed.
+ /// destroyed.
///
/// The caller is responsible for closing the received socket (whose
/// file descriptor is accessible via \c SocketSession::getSocket()).
return (result);
}
-/// \brief Write Unisgned 16-Bit Integer to Buffer
+/// \brief Write Unsigned 16-Bit Integer to Buffer
///
/// This is essentially a copy of isc::util::OutputBuffer::writeUint16. It
/// should really be moved into a separate library.
return (result);
}
-/// \brief Write Unisgned 32-Bit Integer to Buffer
+/// \brief Write Unsigned 32-Bit Integer to Buffer
///
/// \param value 32-bit value to convert
/// \param buffer Data buffer at least four bytes long into which the 32-bit
/// in the configuration file, but is not mandatory. The value of the
/// @c OptionalValue may be initialized to "unspecified" initially. When the
/// configuration parser finds that the appropriate parameter exists in the
-/// configuration file, the default value can be overriden and the value may
+/// configuration file, the default value can be overridden and the value may
/// be marked as "specified". If the parameter is not found, the value remains
/// "unspecified" and the appropriate actions may be taken, e.g. the default
/// value may be used.
good = fs.good();
fs.close();
- // If we weren't able to read a pid send back an execption
+ // If we weren't able to read a pid send back an exception
if (!good) {
isc_throw(PIDCantReadPID, "Unable to read PID from file '"
<< filename_ << "'");
public:
/// \brief Constructor
///
- /// \param probabilities The probabies for all the integers, the probability must be
+ /// \param probabilities The probabilities for all the integers, the probability must be
/// between 0 and 1.0, the sum of probabilities must be equal to 1.
/// For example, if the probabilities contains the following values:
/// 0.5 0.3 0.2, the 1st integer will be generated more frequently than the
/// \brief Reset the probabilities
///
/// Change the weights of each integers
- /// \param probabilities The probabies for all the integers
+ /// \param probabilities The probabilities for all the integers
/// \param min The minimum integer that generated
void reset(const std::vector<double>& probabilities, size_t min = 0)
{
/// after every start of your process. Calling srand() is enough. This
/// method uses default rand(), which is usually a LCG pseudo-random
/// number generator, so it is not suitable for security
-/// purposes. Please get a decent PRNG implementation, like mersene
+/// purposes. Please get a decent PRNG implementation, like Mersene
/// twister, if you are doing anything related with security.
///
/// PRNG initialization is left out of this function on purpose. It may
<< sig << ": " << ex.what());
}
- // Restore the sig action to reenable handling this signal.
+ // Restore the sig action to re-enable handling this signal.
if (sigaction(sig, &prev_sa, 0) < 0) {
// Highly unlikely we can get here.
const char* errmsg = strerror(errno);
/// invoke the registered handler (if one) immediately upon receipt of
/// a registered signal.
///
- /// Prior to invoking the handler, it sets signal action for the given
- /// signal to SIG_IGN which prevents any repeat signal occurrences from
- /// queuing while the handler is executing. Upon completion of the handler,
- /// the signal action is restored which reenables receipt and handling of
- /// the signal.
+ /// Prior to invoking the handler, it sets signal action for the
+ /// given signal to SIG_IGN which prevents any repeat signal
+ /// occurrences from queuing while the handler is executing. Upon
+ /// completion of the handler, the signal action is restored which
+ /// re-enables receipt and handling of the signal.
///
/// @param sig Signal number.
/// @return Boolean false if no on-receipt handler was registered,
return (retstring);
}
-// Tokenise string. As noted in the header, this is locally written to avoid
+// Tokenize string. As noted in the header, this is locally written to avoid
// another dependency on a Boost library.
vector<string>
/// \brief Normalize Backslash
///
-/// Only relevant to Windows, this replaces all "\" in a string with "/" and
-/// returns the result. On other systems it is a no-op. Note that Windows does
-/// recognise file names with the "\" replaced by "/" (at least in system calls,
-/// if not the command line).
+/// Only relevant to Windows, this replaces all "\" in a string with "/"
+/// and returns the result. On other systems it is a no-op. Note
+/// that Windows does recognize file names with the "\" replaced by "/"
+/// (at least in system calls, if not the command line).
///
/// \param name Name to be substituted
void normalizeSlash(std::string& name);
/// \brief Mutex with very simple interface
///
-/// Since mutexes are very system dependant, we create our own wrapper around
+/// Since mutexes are very system dependent, we create our own wrapper around
/// whatever is available on the system and hide it.
///
/// To use this mutex, create it and then lock and unlock it by creating the
/// operation with it. We convert many errors to the isc::InvalidOperation,
/// since the errors usually happen only when used in a wrong way. Any methods
/// or constructors in this class can throw. Allocation errors are converted
-/// to std::bad_alloc (for example when OS-dependant limit of mutexes is
+/// to std::bad_alloc (for example when OS-dependent limit of mutexes is
/// exceeded). Some errors which usually mean a programmer error abort the
/// program, since there could be no safe way to recover from them.
///
-/// The current interface is somewhat minimalistic. If we ever need more, we
+/// The current interface is somewhat minimalist. If we ever need more, we
/// can add it later.
class Mutex : boost::noncopyable {
public:
/// \brief If the mutex is currently locked
///
/// This is debug aiding method only. And it might be unavailable in
- /// non-debug build (because keeping the state might be needlesly
+ /// non-debug build (because keeping the state might be needlessly
/// slow).
///
/// \todo Disable in non-debug build
impl->exception_text_ = e.what();
} catch (...) {
impl->exception_ = true;
- impl->exception_text_ = "Uknown exception";
+ impl->exception_text_ = "Unknown exception";
}
done(impl);
return (NULL);
/// You can wait for it then or just forget it ever existed and leave it
/// live peacefully.
///
-/// The interface is minimalistic for now. We may need to extend it later.
+/// The interface is minimalist for now. We may need to extend it later.
///
/// \note While the objects of this class represent another thread, they
/// are not thread-safe. You're not supposed to call wait() on the same