?? myreductexporter.cpp
字號:
//-------------------------------------------------------------------
// Author........: Aleksander 豩rn
// Date..........:
// Description...:
// Revisions.....:
//===================================================================
#include <stdafx.h> // Precompiled headers.
#include <copyright.h>
#include <kernel/algorithms/myreductexporter.h>
#include <kernel/structures/reducts.h>
#include <kernel/structures/reduct.h>
#include <kernel/utilities/systemkit.h>
#include <kernel/system/fstream.h>
//-------------------------------------------------------------------
// Methods for class MyReductExporter.
//===================================================================
//-------------------------------------------------------------------
// Constructors/destructor.
//===================================================================
MyReductExporter::MyReductExporter() {
}
MyReductExporter::~MyReductExporter() {
}
//-------------------------------------------------------------------
// Methods inherited from Identifier.
//===================================================================
IMPLEMENTIDMETHODS(MyReductExporter, MYREDUCTEXPORTER, ReductExporter)
//-------------------------------------------------------------------
// Methods inherited from Exporter.
//===================================================================
//-------------------------------------------------------------------
// Method........: ExportPrologue
// Author........: Aleksander 豩rn
// Date..........:
// Description...:
// Comments......: Consider using IOKit instead.
// Revisions.....:
//===================================================================
bool
MyReductExporter::ExportPrologue(ofstream &stream, const Structure &structure) const {
// Cast to already verified type (in Apply method).
Handle<Reducts> reducts = dynamic_cast(Reducts *, const_cast(Structure *, &structure));
// Write some general information.
stream << "% Reducts generated by ROSETTA." << endl;
stream << "% Exported " << SystemKit::GetTimestamp() << " by " << SystemKit::GetUser() << "." << endl;
stream << "%" << endl;
stream << "% " << reducts->GetName() << endl;
stream << "% " << reducts->GetNoReducts() << " reducts." << endl;
stream << endl;
return true;
}
//-------------------------------------------------------------------
// Methods inherited from ReductExporter.
//===================================================================
//-------------------------------------------------------------------
// Method........: ExportReduct
// Author........: Aleksander 豩rn
// Date..........:
// Description...: Overloaded to deal with this syntax.
// Comments......:
// Revisions.....:
//===================================================================
bool
MyReductExporter::ExportReduct(ofstream &stream, int /*reduct_no*/, const Reduct &reduct) const {
String formatted;
bool masked = true;
// Format reduct.
if (!reduct.Format(formatted, GetDecisionTable(), masked)) {
Message::Error("Error formatting reduct.");
return false;
}
// Dump formatted reduct to file stream.
stream << formatted << endl;
// Dump support to file stream.
stream << "Support = [" << reduct.GetSupport() << " subtable(s)]" << endl << endl;
return true;
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -