while(!mPendingCellDefinitions.empty())
{
PendingCellDefinition *cellInfo = mPendingCellDefinitions.front();
- TKCellCode *cellCode = mContainer->getCellCode(cellInfo->cellCodeName);
TKCell *newCell = NULL;
- if (cellCode)
+ if (cellInfo->useCellCodeClass)
{
- newCell = mContainer->createCell(cellInfo->location, cellInfo->cellName, cellCode, cellInfo->customScript);
+ TKCellCode *cellCode = mContainer->getCellCode(cellInfo->cellCodeClassOrType);
+ if (cellCode)
+ {
+ newCell = mContainer->createCellWithCellCodeClass(cellInfo->location, cellInfo->cellName, cellCode, cellInfo->customScript);
+ }
+ else
+ {
+ std::string message = std::string("Failed to construct cell: ").append(cellInfo->location).append("#").append(cellInfo->cellName);
+ message.append("\nCellCode '").append(cellInfo->cellCodeClassOrType).append("' couldn't be found.");
+ TKLog::printf("%s", message.c_str());
+ if (dnGlobal()->updateErrorStatus(DNGlobal::ERROR))
+ {
+ dnGlobal()->setMessage1("Initialization failed");
+ dnGlobal()->setMessage2(message);
+ }
+ }
}
else
{
- std::string message = std::string("Failed to construct cell: ").append(cellInfo->location).append("#").append(cellInfo->cellName);
- message.append("\nCellCode '").append(cellInfo->cellCodeName).append("' couldn't be found.");
- TKLog::printf("%s", message.c_str());
- if (dnGlobal()->updateErrorStatus(DNGlobal::ERROR))
- {
- dnGlobal()->setMessage1("Initialization failed");
- dnGlobal()->setMessage2(message);
- }
+ newCell = mContainer->createCellWithoutCellCodeClass(cellInfo->location, cellInfo->cellName, cellInfo->cellCodeClassOrType, cellInfo->customScript);
}
+
if (newCell == NULL)
{
std::string message = std::string("Failed to construct cell: ").append(cellInfo->location).append("#").append(cellInfo->cellName);
return true;
}
-void DNContainerBuilder::addCell(const char *path, std::string name, std::string cellcode, std::string customScript)
+void DNContainerBuilder::defineCellWithoutCellCodeClass(const char *path, std::string name, std::string type, std::string customScript)
+{
+ DEBUG_TRACE("\n===== Define cell (no CellCode class) ================ \nName:%s/%s\nType:%s\nCustom script:\n%s\n", path,name.c_str(), type.c_str(),customScript.c_str());
+
+ PendingCellDefinition *newCellDefine = new PendingCellDefinition();
+ newCellDefine->useCellCodeClass = false;
+ newCellDefine->location = path;
+ newCellDefine->cellName = name;
+ newCellDefine->cellCodeClassOrType = type;
+ newCellDefine->customScript = customScript;
+
+ mPendingCellDefinitions.push(newCellDefine);
+}
+
+void DNContainerBuilder::defineCellWithCellCodeClass(const char *path, std::string name, std::string cellcode, std::string customScript)
{
- DEBUG_TRACE("\n===== Define cell ================ \nName:%s/%s\nClass:%s\nCustom script:\n%s\n", path,name.c_str(), cellcode.c_str(),customScript.c_str());
+ DEBUG_TRACE("\n===== Define cell (CellCode class attached)=========== \nName:%s/%s\nClass:%s\nCustom script:\n%s\n", path,name.c_str(), cellcode.c_str(),customScript.c_str());
PendingCellDefinition *newCellDefine = new PendingCellDefinition();
+ newCellDefine->useCellCodeClass = true;
newCellDefine->location = path;
newCellDefine->cellName = name;
- newCellDefine->cellCodeName = getFQNString(path, cellcode.c_str());
+ newCellDefine->cellCodeClassOrType = getFQNString(path, cellcode.c_str());
newCellDefine->customScript = customScript;
mPendingCellDefinitions.push(newCellDefine);
}
-void DNContainerBuilder::addCellCode(const char *path, std::string name, std::string type, std::string cellScript)
+void DNContainerBuilder::defineCellCodeClass(const char *path, std::string name, std::string type, std::string cellScript)
{
std::string fqnName = getFQNString(path, name.c_str());
mContainer->createCellCode(fqnName, type, cellScript);
}
-void DNContainerBuilder::addConnection(const char *path, std::string origine, std::string destination, std::string name)
+void DNContainerBuilder::defineConnection(const char *path, std::string origine, std::string destination, std::string name)
{
PendingCellConnection *newConnection = new PendingCellConnection();
newConnection->connectionName = name;
DNXMLElement *element = xml->getRoot();
std::string cellName;
- std::string cellCodeName;
+ std::string cellCodeClassName;
std::string cellAPIType;
std::string script;
}
else if (define == "cellcode")
{
- cellCodeName = element->getAttributeValue("name");
+ cellCodeClassName = element->getAttributeValue("name");
cellAPIType = element->getAttributeValue("type");
defineDepth = element->depth;
}
else
{
std::string message = std::string("Syntax error while parsing ").append(path).append(". defnie='").append("' isn't correct.");
- TKLog::printf("%s", message.c_str());
+ TKLog::printf("%s\n", message.c_str());
if (dnGlobal()->updateErrorStatus(DNGlobal::ERROR))
{
dnGlobal()->setMessage1("Initialization failed");
}
else if (parameter == "cellcode")
{
- cellCodeName = element->getAttributeValue("href");
+ cellCodeClassName = element->getAttributeValue("href");
+ cellAPIType = element->getAttributeValue("type");
+ if (cellCodeClassName.length() > 0 && cellAPIType.length() > 0)
+ {
+ std::string message = std::string("Syntax error while parsing ").append(path).append(". CellCode:").append(cellName);
+ message.append("\n'type' can't be defined here if you use CellCode class.");
+ TKLog::printf("%s\n", message.c_str());
+ if (dnGlobal()->updateErrorStatus(DNGlobal::ERROR))
+ {
+ dnGlobal()->setMessage1("Initialization failed");
+ dnGlobal()->setMessage2(message);
+ }
+ }
}
else if (parameter== "connection")
{
{
rname = cellName;
}
- addConnection(path, cellName, target, rname);
+ defineConnection(path, cellName, target, rname);
}
else
{
defineDepth = -1;
if (cellName.length()>0)
{
- addCell(path, cellName, cellCodeName, script);
+ if (cellCodeClassName.length()>0)
+ {
+ defineCellWithCellCodeClass(path, cellName, cellCodeClassName, script);
+ }
+ else
+ {
+ defineCellWithoutCellCodeClass(path, cellName, cellAPIType, script);
+ }
+
cellName = "";
- cellCodeName = "";
+ cellCodeClassName = "";
+ cellAPIType = "";
script = "";
}
else
{
- addCellCode(path, cellCodeName, cellAPIType, script);
- cellCodeName = "";
+ defineCellCodeClass(path, cellCodeClassName, cellAPIType, script);
+ cellCodeClassName = "";
cellAPIType = "";
script = "";
}