Depsgraph: Move class implementation from header to implementation files

This is more proper way to go:

- Avoids re-compilation of all dependent files when implementation changes
  without changed API,

- Linker should have much simpler time now de-duplicating and getting rid
  of redundant implementations.
This commit is contained in:
Sergey Sharybin 2016-11-03 16:03:12 +01:00
parent 06c202002b
commit 93783cb176
4 changed files with 57 additions and 37 deletions

View File

@ -141,6 +141,18 @@ static DepsNodeFactoryImpl<TimeSourceDepsNode> DNTI_TIMESOURCE;
/* ID Node ================================================ */
IDDepsNode::ComponentIDKey::ComponentIDKey(eDepsNode_Type type,
const char *name)
: type(type), name(name)
{
}
bool IDDepsNode::ComponentIDKey::operator== (const ComponentIDKey &other) const
{
return type == other.type &&
STREQ(name, other.name);
}
static unsigned int id_deps_node_hash_key(const void *key_v)
{
const IDDepsNode::ComponentIDKey *key =

View File

@ -145,14 +145,8 @@ struct RootDepsNode : public DepsNode {
/* ID-Block Reference */
struct IDDepsNode : public DepsNode {
struct ComponentIDKey {
ComponentIDKey(eDepsNode_Type type, const char *name = "")
: type(type), name(name) {}
bool operator== (const ComponentIDKey &other) const
{
return type == other.type &&
STREQ(name, other.name);
}
ComponentIDKey(eDepsNode_Type type, const char *name = "");
bool operator==(const ComponentIDKey &other) const;
eDepsNode_Type type;
const char *name;

View File

@ -52,6 +52,44 @@ namespace DEG {
/* Standard Component Methods ============================= */
ComponentDepsNode::OperationIDKey::OperationIDKey()
: opcode(DEG_OPCODE_OPERATION),
name(""),
name_tag(-1)
{
}
ComponentDepsNode::OperationIDKey::OperationIDKey(eDepsOperation_Code opcode)
: opcode(opcode),
name(""),
name_tag(-1)
{
}
ComponentDepsNode::OperationIDKey::OperationIDKey(eDepsOperation_Code opcode,
const char *name,
int name_tag)
: opcode(opcode),
name(name),
name_tag(name_tag)
{
}
string ComponentDepsNode::OperationIDKey::identifier() const
{
char codebuf[5];
BLI_snprintf(codebuf, sizeof(codebuf), "%d", opcode);
return string("OperationIDKey(") + codebuf + ", " + name + ")";
}
bool ComponentDepsNode::OperationIDKey::operator==(
const OperationIDKey &other) const
{
return (opcode == other.opcode) &&
(STREQ(name, other.name)) &&
(name_tag == other.name_tag);
}
static unsigned int comp_node_hash_key(const void *key_v)
{
const ComponentDepsNode::OperationIDKey *key =

View File

@ -56,38 +56,14 @@ struct ComponentDepsNode : public DepsNode {
const char *name;
int name_tag;
OperationIDKey()
: opcode(DEG_OPCODE_OPERATION),
name(""),
name_tag(-1)
{}
OperationIDKey(eDepsOperation_Code opcode)
: opcode(opcode),
name(""),
name_tag(-1)
{}
OperationIDKey();
OperationIDKey(eDepsOperation_Code opcode);
OperationIDKey(eDepsOperation_Code opcode,
const char *name,
int name_tag)
: opcode(opcode),
name(name),
name_tag(name_tag)
{}
int name_tag);
string identifier() const
{
char codebuf[5];
BLI_snprintf(codebuf, sizeof(codebuf), "%d", opcode);
return string("OperationIDKey(") + codebuf + ", " + name + ")";
}
bool operator==(const OperationIDKey &other) const
{
return (opcode == other.opcode) &&
(STREQ(name, other.name)) &&
(name_tag == other.name_tag);
}
string identifier() const;
bool operator==(const OperationIDKey &other) const;
};
/* Typedef for container of operations */