NEBinaryFileLoader& NEIndexedNodeSet::serialize(NEBinaryFileLoader& loader) { // pre: // 상위 함수 호출: // 내부에서 size, length와 _occupiedset을 load 해서 가지고 온다. SuperClass::serialize(loader); // main: type_index size = getSize(); // push를 위한 길이 정보 초기화: _length = 0; type_index occupied_n = -1; for(int n=0; n < size ;n++) { if( ! _occupiedset[n]) continue; // push: // push를 위해서 소유권을 일시 해제: _occupiedset[n] = false; // 삽입: insert(n, NENode()); // 에러처리: NENode& inputed = getElement(n); if( ! &inputed) { KERNAL_ERROR(" : IndexedNodeSet에서 로드 도중에 노드를 생성하지 못했습니다.\n데이터를 버리고 다음 노드를 읽습니다."); // 버리기 위해 노드를 하나 생성: loader >> NENode(); continue; } // 로드: loader >> inputed; }
/* * Constructs a new layer with the provided number of nodes * and a transfer function. */ NELayer::NELayer(int nodesCount, NETransferFunction* transferFunction, NETransferFunction* transferFunctionDerivative) { // Save the number of nodes this->nodesCount = nodesCount; // Save the pointer to the transfer function and its derivative this->transferFunction = transferFunction; this->transferFunctionDerivative = transferFunctionDerivative; // Allocate memory for the nodes this->nodes = (NENode *)malloc(this->nodesCount * sizeof(NENode)); // Loop through the nodes for(int nodeIndex = 0; nodeIndex < nodesCount; nodeIndex++) { // Create the node for this value this->nodes[nodeIndex] = NENode(); } }