Skip to content

Commit

Permalink
[D][core] Added helper function to throw NotImplementedYetException.
Browse files Browse the repository at this point in the history
  • Loading branch information
nical committed Sep 4, 2011
1 parent 5eb353f commit 369b405
Show file tree
Hide file tree
Showing 6 changed files with 79 additions and 12 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Expand Up @@ -5,5 +5,7 @@
*Makefile*
*CMakeFiles*
build/*
*/bin/*
codeblocks/*
*-build-desktop*
*.dblite
2 changes: 1 addition & 1 deletion d/src/extern/dtools/logstream.d
Expand Up @@ -54,7 +54,7 @@ enum{ INFO_0 = 1


/**
* Log class to ease debugging
* Log class to help debugging
*/
class LogStream
{
Expand Down
2 changes: 1 addition & 1 deletion d/src/kiwi/core/base.d
Expand Up @@ -349,7 +349,7 @@ public:
+/
Data data();

void data( kiwi.core.base.Data value );
void data( Data value );
//in{ if( dataType !is null && value !is null ) assert( data.type is dataType ); }

} //properties
Expand Down
7 changes: 6 additions & 1 deletion d/src/kiwi/core/commons.d
Expand Up @@ -14,7 +14,7 @@ LogStream log;

static this()
{
log = new LogStream();
log = new LogStream();
}


Expand Down Expand Up @@ -58,4 +58,9 @@ class NotImplementedYetException : Exception
{
super(msg ~ " is not implemented yet.", file, line);
}
}

auto NotImplemented(string file = __FILE__, int line = __LINE__)(string name) pure
{
return new NotImplementedYetException(name,file,line);
}
62 changes: 56 additions & 6 deletions d/src/kiwi/dynamic/nodegroup.d
Expand Up @@ -2,10 +2,63 @@ module kiwi.dynamic.nodegroup;

import kiwi.core.base;
import kiwi.core.commons;
import kiwi.core.data;
import kiwi.dynamic.node;

import kiwi.graph.acyclic;

class InternalInputPort : InputPort
{
this()
{
super(null);
}
}

class InternalOutputPort : OutputPort
{
this(InputPort linkedInput)
in{ assert( linkedInput !is null ); }
body
{
super(null);
_linkedInput = linkedInput;
}

override
{
@property
{
int maxConnections() { return -1; }
string name() { return _linkedInput.name; }
OutputPort[] subPorts()
{
throw NotImplemented("NodeGroup.subPorts");
}
DataTypeInfo dataType() pure
{
throw NotImplemented("NodeGroup.dataType");
}
Data data()
{
throw NotImplemented("NodeGroup.data");
}
}

bool isComposite()
{
throw NotImplemented("NodeGroup.isComposite");
}
bool isCompatible( InputPort port ){ return (port !is null); }

}
@property void data( kiwi.core.base.Data value )
{
throw NotImplemented("NodeGroup.data:set");
}
private:
InputPort _linkedInput;
}

class NodeGroup : kiwi.core.base.NodeGroup
{
Expand Down Expand Up @@ -41,18 +94,15 @@ class NodeGroup : kiwi.core.base.NodeGroup
node.update();
}

throw new NotImplementedYetException("kiwi.dynamic.nodegroup.NodeGroup.update"
, __FILE__, __LINE__);
throw NotImplemented("kiwi.dynamic.nodegroup.NodeGroup.update");
}
bool serialize( DataStream stream )
{
throw new NotImplementedYetException("kiwi.dynamic.nodegroup.NodeGroup.serialize"
, __FILE__, __LINE__);
throw NotImplemented("kiwi.dynamic.nodegroup.NodeGroup.serialize");
}
bool deSerialize( DataStream stream )
{
throw new NotImplementedYetException("kiwi.dynamic.nodegroup.NodeGroup.deSerialize"
, __FILE__, __LINE__);
throw NotImplemented("kiwi.dynamic.nodegroup.NodeGroup.deSerialize");
}

}// override
Expand Down
16 changes: 13 additions & 3 deletions d/src/kiwi/dynamic/port.d
@@ -1,5 +1,6 @@
module kiwi.dynamic.port;

import kiwi.core.commons;
import kiwi.core.all;


Expand Down Expand Up @@ -79,12 +80,21 @@ class DynamicOutputPort : OutputPort
@property{
int maxConnections() { return -1; }
string name() { return _name; }
OutputPort[] subPorts() { return []; }
OutputPort[] subPorts()
{
NotImplemented("DynamicOutputPort.subPorts");
return [];
}
DataTypeInfo dataType() pure { return _dataType; }
Data data(){ return _data; }
}

bool isComposite() { return false; }
bool isComposite()
{
if(_dataType is null)
return false;
return _dataType.isComposite;
}
bool isCompatible( InputPort port ){ return (port !is null); }

}
Expand Down Expand Up @@ -184,7 +194,7 @@ unittest
assert( !(op_1 is null) && !(ip_1 is null) );
assert( !op_1.isConnectedTo(ip_1) );
assert( !ip_1.isConnectedTo(op_1) );
assert( !op_1.isComposite() );
assert( op_1.isComposite() );
assert( op_1.connect(ip_1) );
assert( op_1.isConnectedTo(ip_1) );
assert( ip_1.isConnectedTo(op_1) );
Expand Down

0 comments on commit 369b405

Please sign in to comment.