1/*
2 * Copyright 2010, Ingo Weinhold, ingo_weinhold@gmx.de.
3 * Distributed under the terms of the MIT License.
4 */
5
6
7#include "Notifications.h"
8
9#include "Directory.h"
10#include "Volume.h"
11
12
13// #pragma mark - EntryCreatedNotification
14
15
16EntryCreatedNotification::EntryCreatedNotification(Directory* directory,
17	const char* name, Node* node)
18	:
19	fDirectory(directory),
20	fName(name),
21	fNode(node)
22{
23}
24
25
26void
27EntryCreatedNotification::NotifyPostCommit() const
28{
29	notify_entry_created(fDirectory->GetVolume()->ID(),
30		fDirectory->BlockIndex(), fName, fNode->BlockIndex());
31}
32
33
34// #pragma mark - EntryRemovedNotification
35
36
37EntryRemovedNotification::EntryRemovedNotification(Directory* directory,
38	const char* name, Node* node)
39	:
40	fDirectory(directory),
41	fName(name),
42	fNode(node)
43{
44}
45
46
47void
48EntryRemovedNotification::NotifyPostCommit() const
49{
50	notify_entry_removed(fDirectory->GetVolume()->ID(),
51		fDirectory->BlockIndex(), fName, fNode->BlockIndex());
52}
53
54
55// #pragma mark - EntryMovedNotification
56
57
58EntryMovedNotification::EntryMovedNotification(Directory* fromDirectory,
59	const char* fromName, Directory* toDirectory, const char* toName,
60	Node* node)
61	:
62	fFromDirectory(fromDirectory),
63	fFromName(fromName),
64	fToDirectory(toDirectory),
65	fToName(toName),
66	fNode(node)
67{
68}
69
70
71void
72EntryMovedNotification::NotifyPostCommit() const
73{
74	notify_entry_moved(fFromDirectory->GetVolume()->ID(),
75		fFromDirectory->BlockIndex(), fFromName, fToDirectory->BlockIndex(),
76		fToName, fNode->BlockIndex());
77}
78
79
80// #pragma mark - StatChangedNotification
81
82
83StatChangedNotification::StatChangedNotification(Node* node, uint32 statFields)
84	:
85	fNode(node),
86	fStatFields(statFields)
87{
88}
89
90
91void
92StatChangedNotification::NotifyPostCommit() const
93{
94	notify_stat_changed(fNode->GetVolume()->ID(), fNode->BlockIndex(),
95		fStatFields);
96}
97
98
99// #pragma mark - AttributeChangedNotification
100
101
102AttributeChangedNotification::AttributeChangedNotification(Node* node,
103	const char* attribute, int32 cause)
104	:
105	fNode(node),
106	fAttribute(attribute),
107	fCause(cause)
108{
109}
110
111
112void
113AttributeChangedNotification::NotifyPostCommit() const
114{
115	notify_attribute_changed(fNode->GetVolume()->ID(), fNode->BlockIndex(),
116		fAttribute, fCause);
117}
118