Example #1
0
    void header (ostream& stream) {
	staticChecks();
	
	binary_write (h_BOM, stream);
	binary_write (h_b, stream);
	binary_write (h_c, stream);
	binary_write (h_n0, stream);
	binary_write (h_nan, stream);
    }
Example #2
0
//========================================================================
void APlatformActor::Save(std::ofstream& file)
{
	binary_write(file, m_CurrentModelId);

	m_OwnerTile->GetCoordinates().Save(file); //id

	binary_write(file, GetActorLocation());

	bool hasTarget = m_Target != nullptr;
	binary_write(file, hasTarget);

	if (hasTarget)
	{
		binary_write(file, m_Target->GetId());
	}
}
Example #3
0
int main()
{
	double value=pow(2,-13)+pow(2,-11)+pow(2,-15);

	value*=pow(2,32);
	double rest=fmod(value,1.0);
	if(isZero(rest))
		binary_write(value,2);
	else
		fprintf(stdout,"Error\n");

	return 0;
}
Example #4
0
    void operator& (long double x, ostream& stream) {
	binary_write (x, stream);
    }
Example #5
0
    void operator& (float x, ostream& stream) {
	binary_write (x, stream);
    }
Example #6
0
    void operator& (unsigned long long x, ostream& stream) {
	binary_write (x, stream);
    }
Example #7
0
    void operator& (unsigned int x, ostream& stream) {
	binary_write (x, stream);
    }
Example #8
0
    void operator& (short x, ostream& stream) {
	binary_write (x, stream);
    }
Example #9
0
    void operator& (signed char x, ostream& stream) {
	binary_write (x, stream);
    }
Example #10
0
    ///@brief Operator& for simple data-types
    //@{
    void operator& (bool x, ostream& stream) {
	binary_write (x, stream);
    }
Example #11
0
//========================================================================
void AHexEditorActor::SaveMap(const FString& name)
{
	if (FPaths::FileExists(name))
	{
		//if file exists copy it to backup file to prevent overriding some maps
		auto newName = name;
		std::stringstream ss;	auto t = std::time(nullptr); ss << t;
		newName.Append(ss.str().c_str());
		std::ifstream src(*name, std::ios::binary);
		std::ofstream dst(*newName, std::ios::binary);
		dst << src.rdbuf();
		src.close();
		dst.close();
	}

	std::ofstream file;
	file.open(*name, std::ofstream::binary);
	
	auto& gridStorage = m_Grid.GetStorage();

	binary_write(file, (unsigned)gridStorage.size());
	this->Save(file); //editor tile first
	for (auto& pair : gridStorage)
	{
		if (pair.second != this)
		{
			pair.second->Save(file);
		}
	}

	binary_write(file, (unsigned)m_AllBarriers.size());
	for (auto* barrier : m_AllBarriers)
	{
		barrier->Save(file);
	}

	binary_write(file, (unsigned)m_AllPlatforms.size());
	for (auto* platform : m_AllPlatforms)
	{
		platform->Save(file);
	}

	binary_write(file, (unsigned)m_AllCompanions.size());
	for (auto* companion : m_AllCompanions)
	{
		companion->Save(file);
	}

	binary_write(file, (unsigned)m_AllBlockers.size());
	for (auto* blocker : m_AllBlockers)
	{
		blocker->Save(file);
	}

	binary_write(file, (unsigned)m_AllBridges.size());
	for (auto* bridges : m_AllBridges)
	{
		bridges->Save(file);
	}

	binary_write(file, (unsigned)m_AllTurrets.size());
	for (auto* turret : m_AllTurrets)
	{
		turret->Save(file);
	}

	binary_write(file, (unsigned)m_AllTeleports.size());
	for (auto* t : m_AllTeleports)
	{
		t->Save(file);
	}

	binary_write(file, m_Finish);
	m_Finish->Save(file);

	file.close();
}
inline Writer& binary_write(Writer &os, const KMerStat &k) {
  os.write((char*)&k.count, sizeof(k.count));
  os.write((char*)&k.raw_data, sizeof(k.raw_data));
  os.write((char*)&k.totalQual, sizeof(k.totalQual));
  return binary_write(os, k.qual);
}