Beispiel #1
0
	PrimitiveShape::PrimitiveShape(
		int type, int sourceblend, int destblend, int blendmethod )
		: m_blendsf( TABLE_ASSERT(
			blendftable, sourceblend, "source blend factor" ) )
		, m_blenddf( TABLE_ASSERT(
			blendftable, destblend, "destination blend factor" ) )
		, m_blendop( TABLE_ASSERT(
			blendoptable, blendmethod, "blend method" ) )
#if !defined( _MSC_VER )
		, m_matrix{
			1, 0, 0, 0,
			0, 1, 0, 0,
			0, 0, 1, 0,
			0, 0, 0, 1,
		}
#endif
	{
#if defined( _MSC_VER )
		memset( &m_matrix, 0, sizeof( m_matrix ) );
		m_matrix[ 0 ] = m_matrix[ 5 ] = m_matrix[ 10 ] = m_matrix[ 15 ] = 1;
#endif
		m_type.store( RANGE_ASSERT(
				type, 0, int( primitivetype::invalid ), "primitive type" ),
			std::memory_order_release );
	}
Beispiel #2
0
// ----------------------------------------------
Record SystemTable::getRecord(ID_t i_record_id) {
  INF("enter SystemTable::getRecord().");
  std::string select_statement = "SELECT * FROM '";
  select_statement += this->m_table_name;
  select_statement += "' WHERE ID == '";
  select_statement += std::to_string(i_record_id);
  select_statement += "';";

  this->__prepare_statement__(select_statement);
  sqlite3_step(this->m_db_statement);
  ID_t id = sqlite3_column_int64(this->m_db_statement, 0);
  DBG("Read id [%lli] from  table ["%s"] of database ["%s"], input id was [%lli].",
      id, this->m_table_name.c_str(), this->m_db_name.c_str(), i_record_id);
  TABLE_ASSERT("Input record id does not equal to primary key value from database!" && id == i_record_id);

  Record record = Record::EMPTY;
  if (i_record_id != UNKNOWN_ID) {
    DBG("Read id [%lli] from  table ["%s"] of database ["%s"].",
        id, this->m_table_name.c_str(), this->m_db_name.c_str());

    ID_t extra_id = sqlite3_column_int64(this->m_db_statement, 1);
    uint64_t timestamp = sqlite3_column_int64(this->m_db_statement, 2);
    const void* raw_datetime = reinterpret_cast<const char*>(sqlite3_column_text(this->m_db_statement, 3));
    WrappedString datetime(raw_datetime);
    const void* raw_ipaddress = reinterpret_cast<const char*>(sqlite3_column_text(this->m_db_statement, 4));
    WrappedString ipaddress(raw_ipaddress);
    int port = sqlite3_column_int(this->m_db_statement, 5);

    DBG("Loaded column data: " COLUMN_NAME_EXTRA_ID " [%lli]; " D_COLUMN_NAME_TIMESTAMP " [%lu]; " D_COLUMN_NAME_DATETIME " ["%s"]; " D_COLUMN_NAME_IP_ADDRESS " ["%s"]; " D_COLUMN_NAME_PORT " [%i].",
         extra_id, timestamp, datetime.c_str(), ipaddress.c_str(), port);
    record = Record(extra_id, timestamp, ipaddress.get(), port);
    DBG("Proper record instance has been constructed.");
  } else {
    WRN("ID [%lli] is missing in table ["%s"] of database %p!",
        i_record_id, this->m_table_name.c_str(), this->m_db_handler);
  }

  this->__finalize__(select_statement.c_str());
  INF("exit SystemTable::getRecord().");
  return (record);
}